Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object reference?
Message
 
À
17/02/2016 10:45:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01631578
Message ID:
01631612
Vues:
64
Obviously, both Thierry and Thomas posted good working options. For obj name evaluation, I prefer:
...
FOR cnt = 1 TO 9
   cLbl = '.DeMenuBut'+ALLTRIM(STR(cnt))
   IF PEMSTATUS(This, m.cLbl, 5) ...
      oLbl = GETPEM(This, m.cLbl)
      ... 
      oLbl.ForeColor = ...
      oLbl.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 
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform