forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help! Combo boxes?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Tue Mar 19, 2002 2:48 pm    Post subject: Help! Combo boxes? Reply with quote

I've never used one before, so please excuse my lameness. How do I get a list into the combo box? I think I've looked over the help and the examples, and am unable to find documentation on this. What am I missing?
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Mar 19, 2002 3:05 pm    Post subject: Reply with quote

Just create your combo element, let's say named COMBO1. Then load your
stuff into the combo like this:

Load the content of a file:
Code:
list loadfile,COMBO1,file.txt


Or load the contents of a list (here list 3)
Code:
list assign,COMBO1,3


Hope it helps

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Tue Mar 19, 2002 4:32 pm    Post subject: Reply with quote

After I do the
Code:
list assign, combo1, 1
is there a way to make the top one in the list the default? When I do it now, the combo box is blank until I select one.
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Mar 19, 2002 4:53 pm    Post subject: Reply with quote

Sure thing!

One way of doing it would be this:

Code:
  LIST SEEK,3,0
  %%listitem = @ITEM(3)
  dialog set,COMBO1,%%listitem


That would enter item No. 1 in your list (still list 3) into the combo dialog.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Tue Mar 19, 2002 5:15 pm    Post subject: Reply with quote

That's basically what I tried but it doesn't work. Here's what I have. What am I doing wrong?

Code:
DIALOG ADD,COMBO,COMBO1,28,77,182,21,,click,list
  list create, 1
  list create, 2
  list loadfile, 1, @path(%0)list.txt
  REPEAT
  parse "%D;%E;%F", @next(1)
  list add, 2, %D
  UNTIL @equal(@index(1),@count(1))
  list assign, combo1, 2
  list seek, 2, 0
  DIALOG set, combo1, @item(2)


If needed the list.txt file contains various info I need later in the form of test|123|456

EDIT - The above works if I take the 'list' style off the combo box. However, is there a way to do it with the 'list' style on?
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Mar 19, 2002 7:17 pm    Post subject: Reply with quote

Hmmmm. If you are using the LIST style, it might be a problem because
with LIST the combo box does not allow you to enter data into the control
- you can just choose values from the drop down list.

And I just made a small test, and the LIST style also blocks using a Win
API call to change the combo box text. Without the LIST style, this also
should work:

Code:
%%dummy = @sendmsg(@win(~COMBO1),$0C,0,NewComboText)


If I think of something else, I'll let you know

Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Tue Mar 19, 2002 8:32 pm    Post subject: Reply with quote

Sorry to intrude, but If you want to set the combo box
to an item in the combo, you can just use the seek command:

list seek,combo1,<item #>

or if you do not know the index of the item
you can do and @match() for the item and
if the Item is found, the combo will be set
to that index. Here is an example:

Code:

  DIALOG CREATE,Combo demo,-1,0,240,93
  DIALOG ADD,COMBO,COMBO1,18,38,180,21,,,list
  DIALOG ADD,BUTTON,BUTTON1,56,76,76,24,Set to Item 3
  DIALOG SHOW
  List add,combo1,"Item 0"
  List add,combo1,"Item 1"
  List add,combo1,"Item 2"
  List add,combo1,"Item 3"
  List add,combo1,"Item 4"
  List add,combo1,"Item 5"
  List add,combo1,"Item 6"   
  list seek,combo1,0
   
  :evloop
  wait event
  goto @event()
 
  :close
  stop
 
  :button1button
  list seek,combo1,0
  %m = @match(combo1,"Item 3")
  goto evloop


hope that helps.

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Mar 19, 2002 9:44 pm    Post subject: Reply with quote

Yeah, Chris ! Of course, that's the way to do it when the combo is a list.

It was sitting right under my nose, but I didn't think of it. Embarassed Rolling Eyes

Keep 'em coming.

Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Wed Mar 20, 2002 8:52 pm    Post subject: Reply with quote

That did it. Thanks guys!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group