Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another Combobox Problem
Message
From
20/09/1998 12:40:51
 
 
To
20/09/1998 11:11:04
Senna Dwipayana
Indo Rebel Apparel Cv
Bandung, Indonesia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00138805
Message ID:
00138820
Views:
14
>Actually what I'm trying to do with the combobox is,
>1. dropped down on got focus event
>2. enabled enter any value on the text area of combobox (style=2)
>3. incremetal search for the value added on text area with the list dropped down
>4. if the value doen't exist then addlistitem(newitem)
>
>And....
>the problem is, I can't do no.2 (with the listbox dropped down), is there any possible way that I can enter any value in the text area of combobox even if the value is not on the list ? (incremental search already set to .F., but still it works the same way)
>
>Hope there's someone can help me with this.
>
>
>Thanks
Hi Senna.

You have to change the style of rthe list to 0 - drop down combo the be able to add new items to it. Then, you can put code like this into the valid method of the combo:
LOCAL lnALen, lnAnswer, lcSelect
lcSelect = THISFORM.PrimaryTable
lnAnswer = 7    && no
IF This.Value > 0
* Do Nothing
ELSE
   IF ASC(THIS.DisplayValue) = 12
      THIS.DisplayValue = ""
   ELSE   
      IF !EMPTY(This.DisplayValue)
         lnAnswer = Messagebox("Do you want to add "+alltrim(This.displayvalue),32+4)
         IF lnAnswer = 6    && yes
            SELECT ClntType
            lnRetVal = GetKey("ClntType", "Cl_Type") 
            IF (lnRetVal = 0) OR (lnRetVal > 2147483646)
               SELECT (lcSelect)
               RETURN .F.
            ELSE
               SELECT ClntType
               APPEND BLANK
               REPLACE Cl_Type  WITH lnRetVal, ;
                       TypeDesc WITH THIS.DisplayValue
               =TABLEUPDATE()
               THIS.Requery()
               THIS.Value = lnRetVal
               THIS.Refresh()
               RETURN .T.
            ENDIF          
         ELSE
            SELECT (lcSelect)
            RETURN .T.
         ENDIF
      ENDIF
   ENDIF
ENDIF
Hope this helps.

Marcia
Previous
Reply
Map
View

Click here to load this message in the networking platform