Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object reference?
Message
From
17/02/2016 11:13:36
 
 
To
17/02/2016 10:45:43
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01631578
Message ID:
01631609
Views:
67
Often Thierrys approach is cleaner. For the other cases where you have to rely on names, the following is faster and IMO cleaner
lcPrefix = '.DeMenuBut'+ALLTRIM(STR(cnt))
store RGB(0,0,0) To (m.lcPrefix + '.ForeColor')
store .f.  To (m.lcPrefix + '.FontUnderline')
>I made a label class for menu options (you can make them so much more attractive that command buttons!), with the look I wanted. I then added how many I needed to the form (9 of them). The class name is 'DeMenuBut'. In the form designer, they are DeMenuBut1 thru 9. To change their appearance, signalling to the user which has been clicked, and which haven't, I run the code below, and it sets all the 'menu buttons' properties correctly.
>
>I made a variable to store the name of the object called MenButton, so when any menu button is clicked, it passes it's name to the routine below - the clicked button caption becomes red and underlined, and all the other captions are black, and not underlined. It works beautifully!
>
>
>cnt=0
>FOR cnt = 1 TO 9
>	ObjForecolor='.DeMenuBut'+ALLTRIM(STR(cnt))+'.ForeColor'
>	ObjFontUnderline='.DeMenuBut'+ALLTRIM(STR(cnt))+'.FontUnderline'
>
>	ThisObj='DeMenuBut'+ALLTRIM(STR(cnt))
>	IF ThisObj#MenButton
>		WITH this
>			&ObjForecolor=RGB(0,0,0)
>			&ObjFontUnderline=.f.
>		ENDWITH 
>	ELSE
>		WITH this
>			&ObjForecolor=RGB(255,0,0)
>			&ObjFontUnderline=.t.
>		ENDWITH
>	ENDIF
>NEXT 
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform