PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → Name substitution
Name substitution
Started by DT, Feb., 05 2004 2:41 PM - 2 replies
Posted on February, 05 2004 - 2:41 PM
Hi
I need a code example for the following problem, did not seem that difficult to achieve until I tried so I suspect it is incorrect syntax on my part
====
Declared 4 variables as String MyString1, MyString2,Mystring3,ControlClic
Place 3 controls on MyWindow as MyControl1,MyControl,MyControl (Edit,Multiline,Actif)
When I clic on any of the above controls the code ControlClic=Myself.Name is executed - This works OK i.e. ControlClic contains name of MyControl2
Perorming other selections will update MyString1, MyString2 and Mystring3 with values - This works OK
Trace shows that all variables have the correct values
What I now need to do is populate the selected control - so a button calls a procedure which contains the code
MyWindow.ControlClic = MyString1+TAB+ MyString2+TAB+Mystring3 - Nothing happens, no update???
Also tried {MyWindow+".ControlClic"} = Nothing???
Substituting the variable for the control name (MyWindow.MyControl1=) works fine
====
In case it should make a difference?? the window has a menu bar and is declared as the 1st application window
Any advice as ever will be very much appreciated
Regards
DerekT
Posted on February, 05 2004 - 2:58 PM
Sorry, but I don't understand!
Raimudn
Hi
I need a code example for the following problem, did not seem that difficult to achieve until I tried so I suspect it is incorrect syntax on my part
====
Declared 4 variables as String MyString1, MyString2,Mystring3,ControlClic
Place 3 controls on MyWindow as MyControl1,MyControl,MyControl (Edit,Multiline,Actif)
When I clic on any of the above controls the code ControlClic=Myself.Name is executed - This works OK i.e. ControlClic contains name of MyControl2
Perorming other selections will update MyString1, MyString2 and Mystring3 with values - This works OK
Trace shows that all variables have the correct values
What I now need to do is populate the selected control - so a button calls a procedure which contains the code
MyWindow.ControlClic = MyString1+TAB+ MyString2+TAB+Mystring3 - Nothing happens, no update???
Also tried {MyWindow+".ControlClic"} = Nothing???
Substituting the variable for the control name (MyWindow.MyControl1=) works fine
====
In case it should make a difference?? the window has a menu bar and is declared as the 1st application window
Any advice as ever will be very much appreciated
Regards
DerekT



http://www.invitec.com
Posted on February, 05 2004 - 4:01 PM
Hi
I need a code example for the following problem, did not seem that difficult to achieve until I tried so I suspect it is incorrect syntax on my part
====
Declared 4 variables as String MyString1, MyString2,Mystring3,ControlClic
Place 3 controls on MyWindow as MyControl1,MyControl,MyControl (Edit,Multiline,Actif)
When I clic on any of the above controls the code ControlClic=Myself.Name is executed - This works OK i.e. ControlClic contains name of MyControl2
Perorming other selections will update MyString1, MyString2 and Mystring3 with values - This works OK
Trace shows that all variables have the correct values
What I now need to do is populate the selected control - so a button calls a procedure which contains the code
MyWindow.ControlClic = MyString1+TAB+ MyString2+TAB+Mystring3 - Nothing happens, no update???
Also tried {MyWindow+".ControlClic"} = Nothing???
Substituting the variable for the control name (MyWindow.MyControl1=) works fine
====
In case it should make a difference?? the window has a menu bar and is declared as the 1st application window
Any advice as ever will be very much appreciated
Regards
DerekT

Hey, DerekT !
Do you know you cannot do multiple control selection ?
Each control get istself the focus. Though i don't understand what you mean with 'populate'.
If you need to simply get the hole list when no control is selected, it's either impossible as there is at least one TABStopped control.
Elsewhere, be aware indirection ({} use to built window components) is suitable with :
- each control for each opened window
- each active vars for each opened window (careful with viewness : globals are of course ok)
It is why you can write {MyWindow+".ControlClic"} as it is a variable and not a control !
it you need de know timelined selected controls you only need to concatenate names into you var at reach control clic :
ControlClic=Myself.Name
will become
ControlClic+=Myself.Name
take care to inster a name separator for further use :
if ControlClic<>"" then ControlClic+=TAB
ControlClic=Myself.Name
Now : your var contain each clicked control in clic order and simply usable as follow :
i is an integer = 1
sControlName is a string = ExtractString(ControlClic,i)
While cControlName<>EOT
info(sControlName)
i++
sControlName = ExtractString(ControlClic,i)
END
Please note that TAB is default separator for ExtractString() an related windev functions.
Hope this cooking code will help.
Regards
R&B



rbesset.net, french unofficial Windev gate