Page 1 of 1

[4.51 x86] SplitterGadget and ComboBoxGadget

Posted: Sat Apr 23, 2011 8:32 am
by breeze4me
1. Drag the separator. Once the height of two ComboBox gadgets is 20 and then it is resized, it occurs repeatedly.
2. In addition, on moving the separator, the second ComboBox text is highlighted, but it's not activated.

Code: Select all

Global old

#height = 40

; Structure my_COMBOBOXINFO
;   cbSize.l
;   rcItem.RECT
;   rcButton.RECT
;   stateButton.l
;   hwndCombo.i
;   hwndEdit.i
;   hwndList.i
; EndStructure
; Procedure GetComboBoxEditHandle(hwndCombo)
;   Protected cbi.my_COMBOBOXINFO\cbSize = SizeOf(my_COMBOBOXINFO)
;   GetComboBoxInfo_(hwndCombo, cbi)
;   ProcedureReturn cbi\hwndEdit
; EndProcedure

Procedure wndproc(hwnd, msg, wParam, lParam)
  If msg = #WM_SIZE
    ;height = (lParam >> 16) & $FFFF
    If GadgetHeight(2) <> #height
      Debug "height: " + Str(GadgetHeight(2)) + " <-- 20"
    Else
      Debug "height: " + Str(GadgetHeight(2))
    EndIf
  EndIf
  
  ProcedureReturn CallWindowProc_(old, hwnd, msg, wParam, lParam)
EndProcedure

If OpenWindow(0, 0, 0, 523, 125, "", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
  ComboBoxGadget(1, 20, 15, 200, #height, #PB_ComboBox_Editable|#PB_ComboBox_LowerCase)
  ComboBoxGadget(2, 225, 15, 260, #height, #PB_ComboBox_Editable|#PB_ComboBox_LowerCase)
  SplitterGadget(3, 10, 10, 490, #height, 1, 2, #PB_Splitter_Vertical|#PB_Splitter_Separator)
  
  ; for showing the resizing problem clearly.
  old = SetWindowLongPtr_(GadgetID(2), #GWL_WNDPROC, @wndproc())
  
  ; same result
  ;hwnd = GetComboBoxEditHandle(GadgetID(2))
  ;old = SetWindowLongPtr_(hwnd, #GWL_WNDPROC, @wndproc())
  
  For i = 0 To 10
    AddGadgetItem(2, -1, "aaaaaaaaaaaaaaaabbbbbbbccc")
  Next
  SetGadgetState(2, 0)
  
  SetGadgetText(1, "abcdefg")
  SetActiveGadget(1)
  
  Repeat
    Event = WaitWindowEvent()
    Select Event
      Case #PB_Event_CloseWindow
        Break
    EndSelect
  ForEver
EndIf

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Posted: Sat Apr 23, 2011 11:57 am
by iostream
Same here on x64.

@breeze4me: If you use SetWindowLongPtr, use the correct GWLP_* constants.

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Posted: Sat Feb 22, 2014 4:11 pm
by Fred
Seems to be a Windows issue with live resize of Combobox

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Posted: Sat Feb 22, 2014 4:28 pm
by RASHAD
Most of the time I use #PB_ComboBox_Image with ComboBoxGadget() to keep the Height intact (ImageList)

Code: Select all

If OpenWindow(0, 0, 0, 523, 125, "", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget| #PB_Window_ScreenCentered)
  ComboBoxGadget(1, 20, 15, 200, #height, #PB_ComboBox_Editable|#PB_ComboBox_LowerCase| #PB_ComboBox_Image)
  ComboBoxGadget(2, 225, 15, 260, #height, #PB_ComboBox_Editable|#PB_ComboBox_LowerCase| #PB_ComboBox_Image)
  SplitterGadget(3, 10, 10, 490, #height, 1, 2, #PB_Splitter_Vertical|#PB_Splitter_Separator)
 
 
  For i = 0 To 10
    AddGadgetItem(2, -1, "aaaaaaaaaaaaaaaabbbbbbbccc")
  Next
  SetGadgetState(2, 0)
 
  SetGadgetText(1, "abcdefg")
  SetActiveGadget(1)
 
  Repeat
    Event = WaitWindowEvent()
    Select Event
      Case #PB_Event_CloseWindow
        Break
    EndSelect
  ForEver
EndIf

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Posted: Sat Feb 22, 2014 4:31 pm
by Fred
It works because it's not the same control used when using the image flag (it's ComboBoxEx()). Regular combox seems to be plagged with the resize bug on Windows.

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Posted: Sat Feb 22, 2014 5:10 pm
by RASHAD
OK Fred :)
You can add a dummy item while creating the gadget routine

Code: Select all

#height = 40

If OpenWindow(0, 0, 0, 523, 125, "", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget| #PB_Window_ScreenCentered)
  ComboBoxGadget(1, 20, 15, 200, #height,#PB_ComboBox_Editable| #PB_ComboBox_LowerCase)
  ComboBoxGadget(2, 225, 15, 260, #height,#PB_ComboBox_Editable| #PB_ComboBox_LowerCase)
  SplitterGadget(3, 10, 10, 490, #height, 1, 2, #PB_Splitter_Vertical|#PB_Splitter_Separator)
 
  AddGadgetItem(1, -1, "")  
  
  For i = 0 To 10    
    AddGadgetItem(2, -1, "aaaaaaaaaaaaaaaabbbbbbbccc")
  Next
  
  SetGadgetState(2, 0)
  SetGadgetText(1, "abcdefg")  
  SetActiveGadget(1)
 
  Repeat
    Event = WaitWindowEvent()
    Select Event
      Case #PB_Event_Gadget
          Select EventGadget()
                Case 3
                       SetGadgetText(2,GetGadgetText(2))

          EndSelect
      Case #PB_Event_CloseWindow
        Break
    EndSelect
  ForEver
EndIf