Page 1 of 1

Twice click ComboBoxgadget

Posted: Mon Jul 24, 2023 10:04 am
by Little_man
Hi all,

When starting the program, the ComboBoxgadget is "unfolded".
The following problem with unfolded" ComboBox;
If I now want to close the program, I have to click twice on the Button "End Program".

How to adjust "unfolded" comboBox only clicking the Button "End Program" once?

With kind regards,
Little_man

Code: Select all

EnableExplicit

;- Opsommingen
Enumeration Window
  #Window
EndEnumeration

Enumeration Gadgets
  #Combo
  #End_Program
EndEnumeration

Procedure Main()
  OpenWindow(#Window, 0, 0, 250, 200, "Test Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    Protected.i A
  
    ComboBoxGadget(#Combo, 50, 25, 150, 22)
    For A = 1 To 5
      AddGadgetItem(#Combo, -1,"ComboBox item " + Str(A))
    Next

    ButtonGadget(#End_Program, 50, 170, 150, 25, "End Program")
    
    SendMessage_(GadgetID(#Combo), #CB_SHOWDROPDOWN, 1, 0)
    SetCursor_(LoadCursor_(0, #IDC_ARROW))

    SetGadgetState(#Combo, 2)
EndProcedure

Main()

;- Event Loop
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break

      ;-> Event Gadget
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #End_Program   ;End Program.
          ;MessageRequester("Information", "Buttonname: End_Program" + #CRLF$ + #CRLF$ + "Test : " + GetGadgetText(EventGadget()))
          End
      EndSelect

  EndSelect
ForEver

Re: Twice click ComboBoxgadget

Posted: Mon Jul 24, 2023 11:24 am
by mk-soft
This is not possible because the window does not yet have the focus when you first click on close.
Is Window Internal.