WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor version 6.X
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Get an Editbox to Appear Based on a Selection in a DropDown Combo Box

Keywords: 	  editbox dropdown combo box

Question:

Do you have an example of how to make and editbox pop up when a user makes a selection on a dropdown listbox?

Answer:

This will put up an editbox if the "other" list item is selected:
Pull_1 = StrCat(1,@Tab,2,@Tab,3,@Tab,"other")
Pull_2 = StrCat("a",@Tab,"B",@Tab,"C",@Tab,"other")
#definefunction showedit(dlghandle,dlgmessage,dlgID,reserved4,reserved5)
   REQUEST_DROPDOWN=6
   switch dlgmessage
     case 0  ; The Dialog Initialization call      
       dialogprocoptions(dlghandle,8,@true)
       break              
     case 8
       Switch dlgID
         Case 003    ;Pull_1
           ;DialogControlGet(dialog-handle,control-number, request-code)     
           ebval=dialogcontrolget(dlghandle,3,REQUEST_DROPDOWN) ;get selection
    
           ;DialogControlState(dialog-handle,control-number,request-code,style) 
;           nStyle = DialogControlState(dlghandle,4,2,0)
           if ebval=="other"
             DialogControlState(dlghandle,4,4,1)
             DialogControlState(dlghandle,8,4,1)
           Else
             DialogControlState(dlghandle,4,3,1)
             DialogControlState(dlghandle,8,3,1)
           EndIf
           Break

         Case 005    ;Pull_2
           ;DialogControlGet(dialog-handle,control-number, request-code)     
           ebval=dialogcontrolget(dlghandle,5,REQUEST_DROPDOWN) ;get selection
    
           ;DialogControlState(dialog-handle,control-number,request-code,style) 
           if ebval=="other"
             DialogControlState(dlghandle,6,4,1)
             DialogControlState(dlghandle,7,4,1)
           Else
             DialogControlState(dlghandle,6,3,1)
             DialogControlState(dlghandle,7,3,1)
           EndIf
           Break
       EndSwitch
       break
   endswitch
   return (-1) ; do default processing
#endfunction
MyDialogFormat=`WWWDLGED,6.1`

MyDialogCaption=`WIL Dialog 1`
MyDialogX=037
MyDialogY=094
MyDialogWidth=222
MyDialogHeight=082
MyDialogNumControls=008
MyDialogProcedure=`showedit`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`143,007,036,012,PUSHBUTTON,DEFAULT,"OK",1,1,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`143,033,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`005,011,036,034,DROPLISTBOX,Pull_1,DEFAULT,DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog004=`065,011,036,012,EDITBOX,TXT_1,"Other Stuff",DEFAULT,4,1,DEFAULT,DEFAULT,DEFAULT`
MyDialog005=`005,037,036,034,DROPLISTBOX,Pull_2,DEFAULT,DEFAULT,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog006=`065,037,036,012,EDITBOX,TXT_2,"Other Stuff",DEFAULT,6,1,DEFAULT,DEFAULT,DEFAULT`
MyDialog007=`067,051,034,008,STATICTEXT,DEFAULT,"Popup Text 2",DEFAULT,7,1,DEFAULT,DEFAULT,DEFAULT`
MyDialog008=`067,023,034,008,STATICTEXT,DEFAULT,"Popup Text 1",DEFAULT,7,1,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog",1)


Article ID:   W15468
File Created: 2003:05:13:11:28:06
Last Updated: 2003:05:13:11:28:06