Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where to declare variables in dialog script
#2
Declare anywhere, initialize under WM_INITDIALOG.

Quote:Does this mean for example "list_csv.FromQmGrid(id(3 hDlg))" gets executed many times?
In your code yes.

correct code:
Code:
Copy      Help
;;;variables declared here:
str- test1
str- test2
str- test4
ICsv- list_csv

sel message
,case WM_INITDIALOG
,list_csv=CreateCsv()
,list_csv.ColumnCount=5
,list_csv.Separator="*"
,list_csv.FromQmGrid(id(3 hDlg))

Quote:and that the other variables get constantly re-declared?
ICsv- list_csv ;;declaration. Declarations are not executed at run time.
list_csv=CreateCsv() ;;initialization. Executed every time. If under WM_INITDIALOG, executed once, because WM_INITDIALOG message is received once in a dialog.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)