[Gambas-user] ComboBox: Detect if the button was clicked

Matti matti.eber at ...3240...
Sat Feb 15 22:18:18 CET 2014


Having a similar problem here.
My first thoughts are:

Public Sub MyComboBox_Change()
   Dim i As Integer
   Dim bFound As Boolean = False

   For i = 0 To MyComboBox.List.Count - 1
     If MyComboBox.Text = Left(MyComboBox.List[i], Len(MyComboBox.Text)) Then
       bFound = True
       Exit
     Else
       bFound = False
     Endif
   Next

   If bFound = False Then
     Print "User typed something that is not in the list."
   Endif

End

But that fires with the first character (and every other) that is not in the list.
I guess it can't be done without the ComboBox_Leave() event?

If anyone has a better approach - please.

If I remember right, there was something like a 'NotInList' event for ComboBoxes in VB, that's what I was looking for.


Am 15.02.2014 04:56, schrieb Bruce:
> I have tried a couple of ways to determine if the user has clicked on
> the button that opens the list in a combobox with no great success. (I
> am trying to discern whether they selected a list item or typed a new
> string in the textbox.)
> It looks like I have to use the Mouse.X and Mouse.Y values to see if
> they are inside the button, but this is extrememly fragile and painful.
> Does anyone have a better idea.
>
> tia
> Bruce
>
>
> ------------------------------------------------------------------------------
> Android apps run on BlackBerry 10
> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> Now with support for Jelly Bean, Bluetooth, Mapview and more.
> Get your Android app in front of a whole new audience.  Start now.
> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>





More information about the User mailing list