| View previous topic :: View next topic |
| Author |
Message |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Feb 21, 2003 10:13 pm Post subject: How to fill a COMBO? |
|
|
Someone told me how to fill a COMBO with contents. But I managed to delete the PM.
Here's my code so far:
| Code: | Title Experiment
DIALOG CREATE,New Dialog,-1,0,240,160
REM *** Modified by Dialog Designer on 21.02.2003 - 19:49 ***
DIALOG ADD,MENU,File,About,-,Exit
DIALOG ADD,COMBO,COMBO1,40,32,176,21,A,Tooltip,LIST,CLICK,EXIT
gosub fillcombo1
DIALOG SHOW
:Evloop
wait event
goto @event()
:fillcombo1
list loadtext,combo1,
"A
"E
"C
"G
"B
DIALOG SET,COMBO1,A
exit
:Close
exit |
Is this the right way to do it? By using the list command I mean.
And how do I set a default value. When I run this nothing shows up in the list. _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Feb 21, 2003 10:19 pm Post subject: |
|
|
LIST SEEK, COMBO1, 0 _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Feb 21, 2003 10:22 pm Post subject: |
|
|
OR ya can use:
if @match(COMBO1, "A")
end
BTW, @match() searches from the current index position - so
ya gotta use LIST SEEK, COMBO1, 0 first to search from
the beginning (if the index isn't already at the start).
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361

Last edited by Mac on Fri Feb 21, 2003 10:25 pm; edited 1 time in total |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Feb 21, 2003 10:24 pm Post subject: |
|
|
Oh, that easy?
Thanks again Mac  _________________
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Feb 21, 2003 10:27 pm Post subject: |
|
|
No prob - but you posted while I was adding a BTW
ya might wanna see...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Feb 21, 2003 10:42 pm Post subject: |
|
|
I just did it like this and it works great. Atleast on my machine. I'm using VDS 4.5
| Code: | :fillcombo1
rem Fills the COMBO1 box with data
list loadtext,combo1,
"A
"E
"C
"G
"B
rem Sets A as the standard selection
if @match(COMBO1, "A")
end
exit |
_________________
 |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Fri Feb 21, 2003 11:44 pm Post subject: |
|
|
Here's a script that might help... I added some extra event labels that
would pertain to your code.
Also note that the code Mac and you discussed doesn't need to be placed
in a script with a COMBO without the LIST style: without it you can use
the value (right after the 21 in your code).
| Code: | Title Experiment
DIALOG CREATE,New Dialog,-1,0,240,134
DIALOG ADD,MENU,File,About,-,Exit
REM -- The "list" style will make it so that input cannot be typed into the COMBO --
DIALOG ADD,COMBO,COMBO1,40,32,176,21,A,Tooltip,LIST,CLICK,EXIT
gosub fillcombo1
DIALOG ADD,BUTTON,ClickMe,70,72,92,24,Click Me
DIALOG SHOW
:Evloop
wait event
goto @event()
:fillcombo1
list loadtext,combo1,
"A
"E
"C
"G
"B
DIALOG SET,COMBO1,A
exit
REM -- Added events --
:COMBO1EXIT
warn You've left the COMBO1 focus !
goto evloop
:CLICKMEBUTTON
warn You've clicked the 'Click Me' button !
goto evloop
:COMBO1CLICK
warn You've clicked the item @item(COMBO1)!
goto evloop
:Close
exit |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Feb 21, 2003 11:44 pm Post subject: |
|
|
Yep - that works because ya just loaded the list. However, if
the user clicks on "C" (for example), and then ya use @match()
again, it will only search from "C". That's why I mentioned the
LIST SEEK command.
Cheers, Mac
OOPS - FF beat me to the post....  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
GeoTrail Valued Contributor


Joined: 18 Feb 2003 Posts: 572 Location: Bergen, Norway
|
Posted: Fri Feb 21, 2003 11:54 pm Post subject: |
|
|
You guys are great.
I'm gonna add FreezingFire to the thank you section in my program
Along with Mac and Rubes_sw  _________________
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|