Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Christian McDonald on July 18, 2009, 08:37:54 PM

Title: VB6 Control Array alternative for PowerBasic? Looping through a few controls?
Post by: Christian McDonald on July 18, 2009, 08:37:54 PM
Is there a way to loop through controls? Kinda like VB6 control arrays?
Title: Re: VB6 Control Array alternative for PowerBasic? Looping through a few controls?
Post by: Patrice Terrier on July 18, 2009, 10:22:56 PM
EnumChildWindow?

...
Title: Re: VB6 Control Array alternative for PowerBasic? Looping through a few controls?
Post by: José Roca on July 18, 2009, 11:14:24 PM
 
It depends in what you mean with loop (I have no idea of what VB6 does). If it means to navigate from one to another using the tab key, then you must add the %WS_TABSTOP style to the controls and call the IsDialogMessage function in the message pump.
Title: Re: VB6 Control Array alternative for PowerBasic? Looping through a few controls?
Post by: Christian McDonald on July 18, 2009, 11:52:25 PM
here is some vb6 code:



Dim i as Long

for i = txtTextBox1.LBound to txtTextBox1.UBound

  txtTextBox1(i).Text = str$(i)

next i



Title: Re: VB6 Control Array alternative for PowerBasic? Looping through a few controls?
Post by: José Roca on July 19, 2009, 12:07:28 AM
For that you will need to use the EnumChildWindows function, retrieve the class name and if the class is "Edit" then set the text using the SetWindowText function. See an EnumChildWindows example here: http://www.jose.it-berater.org/smfforum/index.php?topic=728.0
Title: Re: VB6 Control Array alternative for PowerBasic? Looping through a few controls?
Post by: Christian McDonald on July 19, 2009, 02:27:30 AM
Perfect :)

Thanks