Of these two ways of recovering the value of a control:
Code: Select all
cValue := GetProperty ("frmMain", "name_control", "VALUE")
cValue := frmMain.name_control.VALUEThanks.
Best Regards
Javier
Moderator: Rathinagiri
Code: Select all
cValue := GetProperty ("frmMain", "name_control", "VALUE")
cValue := frmMain.name_control.VALUEHola Javierjparada wrote:Hi,
...
What is the difference, and in what context is "better" to use each of these.
...
Hasta donde yo se no existen diferencias en cuanto a performance, la ultima forma es la mas convencional de usar pero no te permite usar macro sustitución, ej, si compilas esto de va dar error:jparada wrote: cValue := GetProperty ("frmMain", "name_control", "VALUE")
cValue := frmMain.name_control.VALUE
Code: Select all
#include "minigui.ch"
Function Main
DEFINE WINDOW Form_1;
AT 0,0 ;
WIDTH 600 HEIGHT 500 ;
MAIN
y=100
x = 100
FOR n = 1 TO 10
Nombre := "Label_"+alltrim(str(n))
@ y ,x LABEL &nombre OF Form_1
y = y + 30
NEXT
FOR n = 1 TO 10
Nombre := "Label_"+alltrim(str(n))
SetProperty ("Form_1", Nombre , "VALUE", "Javier "+alltrim(str(n)))
NEXT
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
Code: Select all
DEFINE MAIN MENU
DEFINE POPUP "Ver"
ITEM "Ver Label 5" ACTION DoMethod ("Form_1", "Label_5" , "Show")
ITEM "Esconder Label 5" ACTION DoMethod ("Form_1", "Label_5" , "Hide")
END POPUP
END MENU