Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Collapse drop down in combobox from the program? (SOLVED) 24 Oct 2019 21:06 #11427

  • ic2
  • ic2's Avatar
  • Topic Author


  • Posts: 1666
  • I use a subclassed Combobox which auto drops down using the following code:

    METHOD FocusChange( oEvent ) CLASS Ic2ComboBox
    IF lGotFocus // Drop down automatically each time control receives focus
    PostMessage( SELF:Handle(), CB_SHOWDROPDOWN, 1, 0L )
    ENDIF

    Problem is when I assign a value to the combobox manually it also drops down where it shouldn't. I thought to counteract that as follows:

    SELF:oDCMyComboBox:VALUE:="Some value present in the elements of the combobox"
    SendMessage(SELF:oDCMyComboBox:Handle(), CB_SHOWDROPDOWN,0, 0)
    but it does not collapse and stays dropped down.

    How can I achieve that?

    Dick

    Please Log in or Create an account to join the conversation.

    Last edit: by ic2.

    Collapse drop down in combobox from the program? 25 Oct 2019 01:54 #11428

    • TimothyS
    • TimothyS's Avatar


  • Posts: 55
  • Hi Dick,

    What about:

    EXPORT lDrop := TRUE as LOGIC

    METHOD FocusChange( oEvent ) CLASS Ic2ComboBox
    IF lGotFocus .and. SELF:lDrop // Drop down automatically each time control receives focus
    PostMessage( SELF:Handle(), CB_SHOWDROPDOWN, 1, 0L )
    ENDIF
    SELF:lDrop := TRUE

    METHOD Set_Value( uNewValue as usual)
    self:value := uNewValue
    self:lDrop := FALSE

    RETURN NIL

    Then assign as per below:

    SELF:oDCMyComboBox:Set_Value( "Some value present in the elements of the combobox")

    Haven't tested this, but might help.

    Regards,
    Tim

    Please Log in or Create an account to join the conversation.

    Collapse drop down in combobox from the program? 25 Oct 2019 09:52 #11433

    • FFF
    • FFF's Avatar


  • Posts: 1419
  • Timothy Shea wrote:

    METHOD Set_Value( uNewValue as usual)
    self:value := uNewValue 
    self:lDrop := FALSE
    
    RETURN NIL

    Might be better to swap:
    self:lDrop := FALSE
    self:value := uNewValue
    Regards
    Karl (X# 2.15.0.3; Xide 2.15; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Collapse drop down in combobox from the program? 25 Oct 2019 12:14 #11435

    • ic2
    • ic2's Avatar
    • Topic Author


  • Posts: 1666
  • Hello Thomoty, Karl,

    Thanks for the reply. This is one of those situations where it's hard to understand what the computer is doing. I tried something like this already and refined it with your remarks. What happened?

    // Set the lDropDown variable here
    SELF:oDCMyComboBox:VALUE:="Some value"
    - Despite the above settings, _Debout shows lDropDown is false in FocusChange!
    - The FocusChange does NOT seem to be called directly after assigning a value. I put a few statements with waiting time in it to see what happens
    - Then some totally unrelated code is executed
    - AFTER THAT the FocusChange is executed, with lDropDown false, so still dropping down the combobox.

    Solved

    I did solve it however:
    PostMessage( SELF:oDCMyComboBox:Handle(), CB_SHOWDROPDOWN, 0, 0L )

    Contrary to SendMessage this statement actively lets the combobox collapse. It now drops down and directly collapses at the right time, where the statement is exectuted.

    Dick

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1