Hello All,
How to add or remove controls in a window on the fly?
May be it's very elementary or it was already discussed in the forum. In that case please send the url of the discussion.
Thanks in advance.
With best regards.
Sudip
How to add or remove controls on the fly?
Moderator: Rathinagiri
How to add or remove controls on the fly?
With best regards,
Sudip
Sudip
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to add or remove controls on the fly?
It is very easy to add/remove a control once the window is active.
Either add "OF" or "PARENT" keyword to the definition.
For example,
The above code should create a new button on the fly.
Suppose you want to remove a particular control, give the following command.
Either add "OF" or "PARENT" keyword to the definition.
For example,
Code: Select all
define button button_1
row 100
col 100
parent form_1
caption "New Button"
action msginfo("You have pressed the new button!")
end button
Suppose you want to remove a particular control, give the following command.
Code: Select all
Form_1.Button_1.release()
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to add or remove controls on the fly?
Thanks a lot friend
I should have checked it
With best regards.
Sudip
I should have checked it
With best regards.
Sudip
With best regards,
Sudip
Sudip
- Alex Gustow
- Posts: 290
- Joined: Thu Dec 04, 2008 1:05 pm
- Location: Yekaterinburg, Russia
- Contact:
Re: How to add or remove controls on the fly?
Yes - I'm using this technique in my apps often (in one situation I need one group of controls, in another - another group etc.) It's very easy and useful trick.
For example - I use it when I create controls in "auto-zoom'ed" apps (I wrote about this some time ago): I define main window in Main() function, and define controls into this window only after initialization of main window (in function called from ON INIT clause).
For example - I use it when I create controls in "auto-zoom'ed" apps (I wrote about this some time ago): I define main window in Main() function, and define controls into this window only after initialization of main window (in function called from ON INIT clause).
Re: How to add or remove controls on the fly?
And it´s the only way to define controls when you don´t know if or how many you will need during runtime.Alex Gustow wrote:Yes - I'm using this technique in my apps often (in one situation I need one group of controls, in another - another group etc.) It's very easy and useful trick.
For example - I use it when I create controls in "auto-zoom'ed" apps (I wrote about this some time ago): I define main window in Main() function, and define controls into this window only after initialization of main window (in function called from ON INIT clause).
Then you can work with the &-operator to define:
Code: Select all
FOR nPos := 1 TO xx // xx was calculated during runtime
@ 10, 20*nPos ;
LABEL &("LabelY" + STR( nPos, 4, 0 ) ) ;
PARENT Form_5 ;
VALUE STR( nPos, 2 ) ;
WIDTH 20 HEIGHT 10 ;
FONT "ARIAL" SIZE 07
NEXT
- Alex Gustow
- Posts: 290
- Joined: Thu Dec 04, 2008 1:05 pm
- Location: Yekaterinburg, Russia
- Contact:
Re: How to add or remove controls on the fly?
Yes - I use exactly this way very often in such cases.Ricci wrote:Then you can work with the &-operator to define: