Android Question ComboBox Help

Discussion in 'Android Questions' started by Robert Valentino, May 4, 2015.

  1. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    Hi:

    I have a CLASS module I wrote cDropDown which works as a combo box.
    This class creates a ListView to act as the drop down list when the button is pressed.

    EVERYTHING works as it should until I have Multiple Combo Boxes on a Panel.

    If you press the button on one combo box the ListView shows and then if you press the button on another combo button the other ListView shows but the first one still shows because you did not select anything.

    Is there someway I can realize that the listview has lost focus so that I can close (hide) it's listview.

    So clicking on a a different combo box button without selecting anything from the first will close the first?

    BobVal
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can do something similar to what I did in AnotherDatePicker. When the picker is opened it is added to a full screen transparent panel. If the user clicks on this panel then the picker is closed.
     
  3. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    Very Interesting Idea.

    What I came up with was this.

    I have my CLASS module cDropDown and made a CODE module cDropDownCommon when I click on the cDropDown button it calls a routine in cDropDownCommon passing Me (itself) which is save in the cDropDownCommon Globals. When / If another cDropDown button is clicked it calls the cDropDownCommon which compares what it has to what is being passed if different it uses it copy to call a routine.

    see code below.

    Code:
    Sub Process_Globals
      
    Public mLastDropDown As  Object = Null
    End Sub

    Public Sub ShowDropDown(Showing As Object)

        
    Dim CurrentDropDown As cDropDown = mLastDropDown
        
    Dim ShowingDropDown As cDropDown = Showing
       
        
    If CurrentDropDown <> Null AND CurrentDropDown.IsInitialized AND CurrentDropDown <> ShowingDropDown Then CurrentDropDown.CloseDropDown
         
        mLastDropDown = Showing
    End Sub

    Public Sub CloseDropDown(Closing As Object)

        
    Dim CurrentDropDown As cDropDown = mLastDropDown
        
    Dim ClosingDropDown As cDropDown = Closing

        
    If CurrentDropDown <> Null AND CurrentDropDown.IsInitialized AND CurrentDropDown = ClosingDropDown Then CurrentDropDown = Null
    End Sub
    NOW I am not sure what I am doing is legal or right but it is working. Would be nice if a CLASS module has some common storage.


    BUT as I am writing this I realize your Idea is probably better. Because I have other fields (togglebutton, checkbox, etc) that a user can click on while the dropdown is showing and if does not close at that point.

    So I will convert to your idea tomorrow. Time for some sleep

    Thanks for the help

    BobVal
     
  4. LucaMs

    LucaMs Expert Licensed User


    Yes, but it works if AnotherDatePicker works as Dialog.
    The panel, in this way, does not allow any other views to receive the "touch".

    Having two or more combo means not using them in a Dialog.

    I remember (strange!?!?) many attempts to resolve this that I made along with @stevel05.


    [EDIT - Found the thread - I should read it again :) ]
     
    Last edited: May 4, 2015
  5. LucaMs

    LucaMs Expert Licensed User

    There is another problem: what if you wanted use that panel and a "dialog view" which uses a transparent panel? :mad:



    [EDIT: answering to myself: set BringToFront for the panel of the dialog]
     
    Last edited: May 4, 2015
  6. RandomCoder

    RandomCoder Well-Known Member Licensed User

    I think you are making problems where they don't exist. For instance when the control is opened on the transparent panel, If the user were to attempt to click on something behind the transparent panel them you would be able to programmatically closer the first control and allow the click event to pass through to the control the user was attempting to click on. You just return true or false in the panel click event (I don't remember which way round it is to pass or consume the click event).
     
  7. ac9ts

    ac9ts Active Member Licensed User

    I just "fixed" a similar problem where I had 3 combo boxes all lined up vertically. Since they were the same color, they would overlap each other. I put a flag in the process globals section and don't allow more than 1 combo box to be open at a time.
     
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