[4.51 x86] SplitterGadget and ComboBoxGadget

Windows specific forum
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

[4.51 x86] SplitterGadget and ComboBoxGadget

Post 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
iostream
User
User
Posts: 12
Joined: Thu Jul 31, 2008 12:36 pm
Location: Germany

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Post by iostream »

Same here on x64.

@breeze4me: If you use SetWindowLongPtr, use the correct GWLP_* constants.
PB 4.51 with Windows 7 Professional & Linux Mint Julia
Fred
Administrator
Administrator
Posts: 18263
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Post by Fred »

Seems to be a Windows issue with live resize of Combobox
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4955
Joined: Sun Apr 12, 2009 6:27 am

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Post 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
Egypt my love
Fred
Administrator
Administrator
Posts: 18263
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Post 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.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4955
Joined: Sun Apr 12, 2009 6:27 am

Re: [4.51 x86] SplitterGadget and ComboBoxGadget

Post 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
Egypt my love
Post Reply