B4J Question ComboBox - How can I tell the use has entered it ?

Discussion in 'B4J Questions' started by Gary Miyakawa, May 26, 2015.

  1. Gary Miyakawa

    Gary Miyakawa Active Member Licensed User

    I've looked thru the members and generated members..

    I'd like to know when someone clicks into a combobox...

    How would I detect that ?

    Thanks,

    Gary Miyakawa
     
  2. Daestrum

    Daestrum Well-Known Member Licensed User

    Code:
    Sub comboBox_MouseClicked (EventData As MouseEvent)
                    .....
    End Sub
    Then you can check if comboBox.SelectedIndex <> -1 which means user has chosen something.
    To get the item use
    Code:
    comboBox.Items.Get(comboBox.SelectedIndex)
     
  3. Gary Miyakawa

    Gary Miyakawa Active Member Licensed User

    Thank you for your reply.

    ComboBox doesn't have a "MouseClicked" event...

    It's only has "SelectedIndexChange" and and "ValueChange"

    ChoiceBox has them, but not ComboBox...
     
  4. Daestrum

    Daestrum Well-Known Member Licensed User

    Odd my old program which has the layout made in scene builder containing a combobox , definitely has mouseclicked as an event (but it doesn't show up in the designer > generate members list) just the two you mentioned.
    An extract of the code I use
    Code:
    Private textBox1,recCount As TextField
        
    Private selectButton,fromButton,whatButton,goButton As Button
        
    Private choiceBox As ComboBox
        
    Private fromWhere As String
        
    Private whichSelect As Int
    Then further down I use
    Code:
    Sub choiceBox_MouseClicked (EventData As MouseEvent)
        
    If choiceBox.SelectedIndex <> -1 Then
            whatButton.RequestFocus
            choiceBox.Enabled = 
    False
            
    Select whichSelect
            
    Case 1:
                fromWhere = choiceBox.Items.Get(choiceBox.SelectedIndex)
            
    Case 2:
                
    Dim tmp As String
                tmp = choiceBox.Items.Get(choiceBox.SelectedIndex)
    I checked the layout again and it reports the control as a ComboBox.
     
  5. Gary Miyakawa

    Gary Miyakawa Active Member Licensed User

    Thank you again! Looks like we might have found a bug-a-boo in the Designer side of B4J...

    I'll post this on the Bug side and see if Erel has an answer for us.

    Cheers,

    Gary Miyakawa
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice