Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Combo Box In Custom Dialog


2 replies to this topic

runningquicklynowher

runningquicklynowher
  • Members
  • 20 posts

Posted 21 December 2001 - 18:45

I have a combo box control on a custom dialog that does not seem to want to cooperate with me.

The dialog displays a listing of virtual directories found on the target machine in the combo box.  From here the user can select from the list of existing virtual directories or type in a new virtual directory name.  To further complicate things, I have a text field and a browse button on the dialog as well.  The text field will display the physical directory location of the already existing virtual directory selected from the combo box.  The browse button will be disabled if an already exisiting virtual directory is selected, but will enable if the user chooses to type in a new virtual directory name.
Here is the problem I am having.  I have no trouble with the existing virtual directories or displaying their corresponding physical directories correctly, but if I type in a new virtual directory the combo box is not properly recognizing the text as having changed and thus is taking no actions.  How can I trap so that when the combo box has text typed into it the browse button will be enabled?

here is a code snipet.  Case IDC_VIRT_DIR_LIST is the section where I am trying to check for changes to the combo box.  Like I mentioned above it works for selections in the list, but not for typed in text.
nCmdValue = WaitOnDialog (szDialog);
switch ( nCmdValue )
    case DLG_INIT:
          **(perform initialization logic)**
     case DLG_ERR:
          **(perform error logic)**
      case IDOK:
          **(perform OK button logic)**
     case SD_PBUT_BACK:
          **(perform back button logic)**
     case IDCANCEL:
          **(perform cancel button logic)**
     case DLG_CLOSE:
          **(perform close button logic)**
     case IDC_VIRT_DIR_LIST:  
          nResult = CtrlGetSubCommand (szDialog);
          if (nResult = EDITBOX_CHANGE) then
               **(enable browse button and such here)**
          endif;
     case IDC_BROWSE:
          **(perform browse button logic)**    endswitch;

Any help would be greatly appreciated...


lasenbby

lasenbby
  • Members
  • 744 posts

Posted 28 December 2001 - 20:16

(Psudo code)

// get the string in the combo box
CtrlGetText (szDialogName, nControlID, svText);
// if the retruned string is empty then...
if StrCompare(svText, "") = 0 then
 // there is no text in the box
 WinSubEnableControl( <browse-button control id> ...
else
 WinSubEnableControl( <browse-button control id>...
endif;


runningquicklynowher

runningquicklynowher
  • Members
  • 20 posts

Posted 04 January 2002 - 23:43

Thanks for replying lasenbby.  
I tried similar things, but for some reason the combo box just wasn't detecting when focus was in it due to the user typing text in the field.  
I caved and added and extra Edit Box control and converted the combo box to not allow typing directly in it and instead put a static "new directory" entry that then enables the edit box and the browse button when it is selected.  Man is this dialog cluttered....