Page 1 of 1
ComboBoxGadget Bug
Posted: Sat Jan 10, 2015 10:24 am
by Lite
Hello
On Windows XP and Windows 7 come a Error with ComboBox.
Maybe on more Windows, but not tested.
The PureBasic gadget created a large window if not items inside.
it is on "windows xp themes is off".
Winapi Combobox works fine.
Greetings
Lite
example:
Code: Select all
Enumeration
#Window
EndEnumeration
; Note:
; compileroptions: deactive modern theme windows xp style
; [ ] active modern theme Windows xp support
OpenWindow(#Window, 0, 0, 400, 300, "ComboBox Bug", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
TextGadget(0, 10, 20, 250, 20, "Winapi Combobox")
CreateWindow_(#WC_COMBOBOX, @"", #CBS_AUTOHSCROLL|#CBS_DROPDOWN|#CBS_SIMPLE|#WS_CHILD|#WS_VISIBLE, 10, 40, 200, 20, WindowID(#Window), #Null, #NUL, #Null)
TextGadget(1, 10, 80, 250, 20, "PureBasic Combobox")
ComboBoxGadget(5,10,100,200,25,#CBS_AUTOHSCROLL|#CBS_DROPDOWN|#CBS_SIMPLE)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
Re: ComboBoxGadget Bug
Posted: Mon Jan 12, 2015 12:49 pm
by Shardik
It seems that PB internally looses the GWL_STYLE values of its ComboBox if Windows XP theme support is disabled. As a workaround you may insert the two following lines behind the definition of the PureBasic ComboBox which will result in the same behaviour of PB's dropdown list and the API one (tested on Windows XP SP3 and Windows 7 x86 SP1):
Code: Select all
SetWindowLongPtr_(GadgetID(5), #GWL_STYLE, GetWindowLongPtr_(GadgetID(5), #GWL_STYLE))
ResizeGadget(5, #PB_Ignore, #PB_Ignore, #PB_Ignore, 25)
Re: ComboBoxGadget Bug
Posted: Mon Jan 12, 2015 4:03 pm
by Lite
Thanks for your workarround.
interessting is. the winapi combobox can not create smaller than 22 pixel high.
PureBasic combobox can reduce size smaller than 22 pixel.
after this come the error and your workarround not work.
is highvalue equal and higher 22 pixel it works nicely.
Regards
Lite
Re: ComboBoxGadget Bug
Posted: Tue Jan 13, 2015 12:14 am
by RASHAD
No need to use unneeded API flags with PB ComboBox()
Because it is already activated
Code: Select all
Enumeration
#Window
EndEnumeration
; Note:
; compileroptions: deactive modern theme windows xp style
; [ ] active modern theme Windows xp support
OpenWindow(#Window, 0, 0, 400, 300, "ComboBox Bug", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
TextGadget(0, 10, 20, 250, 20, "Winapi Combobox")
CreateWindow_(#WC_COMBOBOX, @"", #CBS_AUTOHSCROLL|#CBS_DROPDOWN|#CBS_SIMPLE|#WS_CHILD|#WS_VISIBLE, 10, 40, 200, 20, WindowID(#Window), #Null, #NUL, #Null)
TextGadget(1, 10, 80, 250, 20, "PureBasic Combobox")
ComboBoxGadget(5,10,100,200,25)
AddGadgetItem(5,-1,"")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
Re: ComboBoxGadget Bug
Posted: Tue Jan 13, 2015 4:06 pm
by Shardik
RASHAD,
while your example is indeed simpler than mine (without the need of an API function) it doesn't show the same behaviour than mine...
In your example the API and PB ComboBoxes show a different behaviour. While the API ComboBox displays a thin black bar as drop down list (signalling that the drop down list is empty), your PB ComboBox displays a drop down list with an empty entry (both with and without Windows XP theme support)...
Re: ComboBoxGadget Bug
Posted: Tue Jan 13, 2015 5:53 pm
by RASHAD
Hi Shardik
Yes I know
But it is the same as PB ComboBox with XP skin enabled
So you have to accept it for both cases or consider it as a bug and ask Fred to solve the problem
Happy new year mate
Still on time I think
Edit :
Strange behavior
Try the next with XP skin disabled
Code: Select all
Enumeration
#Window
EndEnumeration
; Note:
; compileroptions: deactive modern theme windows xp style
; [ ] active modern theme Windows xp support
OpenWindow(#Window, 0, 0, 400, 300, "ComboBox Bug", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
TextGadget(0, 10, 20, 250, 20, "Winapi Combobox")
CreateWindow_(#WC_COMBOBOX, @"", #CBS_AUTOHSCROLL|#CBS_DROPDOWN|#CBS_SIMPLE|#WS_CHILD|#WS_VISIBLE, 10, 40, 200, 20, WindowID(#Window), #Null, #NUL, #Null)
TextGadget(1, 10, 80, 250, 20, "PureBasic Combobox")
ComboBoxGadget(5,10,100,200,25,#CBS_AUTOHSCROLL|#CBS_DROPDOWN|#CBS_SIMPLE)
SetWindowLongPtr_(GadgetID(5), #GWL_STYLE, GetWindowLongPtr_(GadgetID(5), #GWL_STYLE))
ResizeGadget(5, #PB_Ignore, #PB_Ignore, #PB_Ignore, 25)
For x = 0 To 10
AddGadgetItem(5,x,"Item # : "+Str(x))
Next
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
Re: ComboBoxGadget Bug
Posted: Mon Aug 17, 2015 8:41 am
by Fred
Not a real bug, only a small difference between common controls. When empty, you should disable your combobox anyway.