| View previous topic :: View next topic |
| Author |
Message |
DeMoNHeaD Guest
|
Posted: Tue Jul 02, 2002 12:22 am Post subject: Combo Box Question |
|
|
| during loading time, i load a file to a combo box. After finished loading, i enter a string into it. When i pushed a button, i want it to check whether the string i entered is already in the combo box item or not. If it's not in the list, i want it to popup a child dialog,asking about other information. Can it be done?? I dont want it to be a case-sensitive. I've been struggling with this for such time. Does anyone know??? |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Jul 02, 2002 1:45 am Post subject: |
|
|
Remember you can treat a Combo element pretty much just like a list, so you can use @MATCH().
Try this:
| Code: |
Title Combo Check
DIALOG CREATE,Combo Check,-1,0,240,87
REM *** Modified by Dialog Designer on 7/1/02 - 21:31 ***
DIALOG ADD,COMBO,COMBO1,5,32,180,21
DIALOG ADD,BUTTON,Check,36,89,64,24,Check It
DIALOG SHOW
REM Load info into list here
LIST LOADTEXT,COMBO1
"Fred
"Bill
"Jim
"Joe
:Evloop
wait event
goto @event()
:CheckBUTTON
REM Check if the text entered is already in Combo1
REM %m will be 1 if the text is in Combo1
%m = @MATCH(Combo1,@DLGTEXT(Combo1))
if @GREATER(%m,0)
REM Goto Label to make child window for more info
goto CreateChild
else
info Text entered is not already in Combo1
end
goto evloop
:CreateChild
info Open child dialog and get info here
goto evloop
:Close
exit
|
Enter a name that's in the combo and click Check it. Then enter something that's not in the combo. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Tue Jul 02, 2002 1:50 am Post subject: |
|
|
This may help. I think it is what you are looking for. It can
be refined to be better.
| Code: |
DIALOG CREATE,Add to combo Demo,-1,0,240,113
REM *** Modified by Dialog Designer on 7/1/2002 - 21:37 ***
DIALOG ADD,COMBO,COMBO1,12,24,180,21,,,list
DIALOG ADD,EDIT,EDIT1,48,28,180,19
DIALOG ADD,BUTTON,BUTTON1,74,66,104,24,Add/Check Text
DIALOG SHOW
list add,combo1,File1.txt
list seek,combo1,0
:evloop
wait event
goto @event()
:close
stop
:button1button
%%chk = @dlgtext(edit1)
if %%chk
%m = @match(combo1,%%chk)
if %m
Info %%chk was found in combo. Cannot add.
goto evloop
else
list add,combo1,%%chk
Info %%chk added to combo
goto evloop
end
else
Warn No text to Add/Check.
end
goto evloop
|
_________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
|
| 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
|
|