Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Textbox control
Message
From
29/05/1998 11:50:37
 
 
To
29/05/1998 09:57:21
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00103062
Message ID:
00103137
Views:
27
>Basically what I want to do is present a user with a 5 X 5 square of choices. Each cell has specific content through the control source attached from a table. When the user clicks on a choice, the backcolor is changed. Clicking the same choice again toggles it back to the original color. No problem so far...everything works...the only problem is that I do not want the user to be able to change the content. When I set the textbox to readonly, of course it will not take the code in the click() method...so I set readonly to .f. then the code, and then set readonly to .t. It still doesn't work because the control still has focus. Any suggestions? I was going to use a command button, but didn't see a way to change the backcolor easily.
>
Tom,

Have you thought about using a custom class composed of a container and a label? The container would initially be set to "raised" style (.specialeffect = 0) to look like a button. When it is clicked, it could be reset to "inset" style (.specialeffect = 1) to look like a button that has been depressed. You could also easily change the backcolor. The label caption would be set programmatically in the init() event of the container -- thus no matter what the user does to it, it could not be changed interactively.

It would take a few minutes of programming to develop the container object -- let's call it a "textbutton". You would have to set label methods such as click(), dblclick(), mousedown() and mouseup() to the respective methods of the parent container, i.e.,
*-- txtbuttonlabel.Click()

this.parent.Click()

RETURN
This makes certain that mouseactivity over the label is transferred to the container for action. To give the button the appearance of depressing when the mousebutton is down, use the following in the mousedown() event:

*-- textbutton.mousedown()
WITH this
.specialeffect = 1
.backcolor = ?
ENDWITH

RETURN
<\PRE>
When the user releases the mouse, the mouseup event can be used to restore backcolor and specialeffect to normal.

Anyway, the textbutton offers a lot of flexibility and seems ideal for the approach you are using.

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform