I have a combobox and a textbox in a small dialog (DDT)
The user can Select a Company ID from the combobox
or enters one in the textbox.
If you select one from the combobox, it reads the company
name and sets a label control to that company name.
This all works just fine.
I thought however, why not eliminate the text box and allow
entry in the combobox too.
So, I added the control get text statement to the callback
routine within a select case CBCTLMSG >case %CBN_EDITCHANGE
in addition to the combobox get text statement.
Once I have typed in a valid ID in the combobox, the company
name shows up like it should but the company ID is not kept
when i exit. If I select from the combobox or type it in the
textbox it does retain it as before.
It's got to be something simple.
I guess I should show the code though.
*** ok I found that if I rem the combobox get text statement
*** that it retains the text that i type in but then i can
*** no longer select it from the list.
------------------
[This message has been edited by Fred Buffington (edited September 19, 2001).]
The user can Select a Company ID from the combobox
or enters one in the textbox.
If you select one from the combobox, it reads the company
name and sets a label control to that company name.
This all works just fine.
I thought however, why not eliminate the text box and allow
entry in the combobox too.
So, I added the control get text statement to the callback
routine within a select case CBCTLMSG >case %CBN_EDITCHANGE
in addition to the combobox get text statement.
Once I have typed in a valid ID in the combobox, the company
name shows up like it should but the company ID is not kept
when i exit. If I select from the combobox or type it in the
textbox it does retain it as before.
It's got to be something simple.
I guess I should show the code though.
*** ok I found that if I rem the combobox get text statement
*** that it retains the text that i type in but then i can
*** no longer select it from the list.
Code:
. . GLOBAL UserName as String GLOBAL Coidx$ GLOBAL abort% CALLBACK FUNCTION propcallback LOCAL getnam AS clityp CID&=CBCTL SELECT CASE cid& CASE 103 DIALOG END hDlg2,1 propcallback=1 CASE 113 DIALOG END hDlg2,1 abort%=1 CASE 114 COMBOBOX GET TEXT CBHNDL, 114 TO UserName SELECT CASE CBCTLMSG CASE %CBN_EDITCHANGE CONTROL GET TEXT CBHNDL, 114 TO UserName END SELECT coidx$=UserName IF coidx$<>prior_coid$ THEN OPEN coidx$+"\client" FOR RANDOM ACCESS READ WRITE AS #9 LEN=LEN(getnam) GET #9,1,getnam xnam$=getnam.clnam CONTROL SET TEXT hDlg2,120,RTRIM$(xnam$) CLOSE #9 prior_coid$=coidx$ END IF CASE 117 CONTROL GET TEXT CBHNDL, 117 TO UserName coidx$=UserName END SELECT EXIT FUNCTION END FUNCTION FUNCTION GETCLI() export as string . . . DIALOG NEW 0,dTitle$,,,200,150,%DS_3DLOOK,%WS_EX_LEFT TO hDlg2 CONTROL ADD LABEL, hDlg2,119," Select",10,33,40,12 CONTROL ADD LABEL, hdlg2,102,"Client ID:",10,47,40,12 CONTROL ADD FRAME, hdlg2,116,"",8,4,181,84,,%WS_EX_WINDOWEDGE CONTROL ADD BUTTON, hDLG2,103,"OK",70,116,20,16,%BS_CENTER,%WS_EX_LEFT CONTROL ADD BUTTON, hDLG2,113,"CANCEL",100,116,40,16,%BS_CENTER,%WS_EX_LEFT CONTROL ADD LABEL, hDlg2,120,"Company Name displays here",12,74,175,12,%SS_CENTER CONTROL ADD COMBOBOX, hDlg2,114,directories$(),70,14,60,60,%WS_VSCROLL ''AND %CBS_DROPDOWN COMBOBOX SELECT hDlg2, 114, 1 CONTROL ADD TEXTBOX, hDlg2, 117,coid$,70,96,50,14 CONTROL ADD LABEL, hDlg2, 118,"Or Enter it:",10,98,40,14 DIALOG SHOW MODAL hDLG2, CALL propcallback IF abort%=0 THEN FUNCTION=coidx$ ELSE FUNCTION="" abort%=0 END IF END FUNCTION _
------------------
[This message has been edited by Fred Buffington (edited September 19, 2001).]
Comment