Strange behaviour of ComboBox on Windows 2000

Everything else that doesn't fall into one of the other PB categories.
Little John
Addict
Addict
Posts: 4873
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Strange behaviour of ComboBox on Windows 2000

Post by Little John »

Hi all,

recently I discovered by accident that an EXE program of mine, compiled with PB 4.20, did not run as expected on Windows 2000 SP 4. On Windows XP the program works fine.
Below you'll find a small example code that demonstrates the behaviour. On Windows XP, whether you assign 0 or a value <> 0 to #Method, the ComboBox will contain all 3 items, as expected. On Windows 2000 SP 4, using either method, the resulting ComboBox only contains the first item named "open". Can someone tell me what's going on there? Is this a bug in PB?

Regards, Little John

Code: Select all

; PureBasic 4.20

EnableExplicit

#Method = 0

#Title = "Combobox test"
#Window = 0
#Combo = 0

If OpenWindow(#Window, 400, 150, 200, 100, #Title,  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar)
   If CreateGadgetList(WindowID(#Window))
      ComboBoxGadget(#Combo, 30, 30, 100, 20, #PB_ComboBox_Editable)
   EndIf
EndIf

AddGadgetItem(#Combo, 0, "open")
SetGadgetState(#Combo, 0)

; Both following methods have no effect on Windows 2000 SP 4:
CompilerIf #Method = 0
   AddGadgetItem(#Combo, 1, "print")
   AddGadgetItem(#Combo, 2, "printto")
CompilerElse
   AddGadgetItem(#Combo, -1, "print")
   AddGadgetItem(#Combo, -1, "printto")
CompilerEndIf

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Code: Select all

ComboBoxGadget(#Combo, 30, 30, 100, 200, #PB_ComboBox_Editable)
On XP it works only while Style is enabled, disable XP Style and you have
the same result as on w2k
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Little John
Addict
Addict
Posts: 4873
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

Thomas,

thanks for your quick reply. Why does it work correctly on Windows XP? This is confusing. I would appreciate it, if the problem would occur on Windows XP, too. In that case, I would have seen (and fixed) it immediately.

I actually didn't think about the value for the "height" parameter. I just created the GUI with the visual designer. So it's important for me to remember, that I can't use the code produced by the Visual Designer as is, but I always have to change at least that value ...

However, as you see I used #PB_ComboBox_Editable. In the actual program, I don't know beforehand how many strings the user will enter into the ComboBox. So how can I know what value I am supposed to choose for the "height" parameter?

Regards, Little John
Last edited by Little John on Wed Nov 05, 2008 6:49 pm, edited 1 time in total.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

> Why does it work correctly on Windoes XP?
XP Style make it larger, disable the XP Style and you have the same result.

Another way to solve the problem is to use PB4.30 :mrgreen:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Little John
Addict
Addict
Posts: 4873
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

Oops ... I read your first reply before it was finished. Thanks again!

Regards, Little John
Post Reply