Better ComboBox gadget support

Just starting out? Need help? Post your questions and find answers here.
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Better ComboBox gadget support

Post by Bitblazer »

The help page for the combobox gadget does not list disablegadget() as being supported. It seems to work to use disablegadget in windows to disable a combobox, but enabling doesnt seem to work. It would be nice to have a working dis/enable method for the combobox. The best documented replacement i found currently is to hide/unhide it and thats very poor style (confusing the user) as parts of an applications GUI disappear and appear again.

Tested with windows 7 x64 using PureBasic 5.62 x86
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Better ComboBox gadget support

Post by Dude »

You're correct that the manual doesn't include DisableGadget() for the ComboBoxGadget() help entry, but disabling and enabling a ComboBoxGadget() works just fine here; and I have the same PC specs and PureBasic version as you. Can you post some code that shows the problem?
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Better ComboBox gadget support

Post by Bitblazer »

Then maybe its the combination with the PurevisionXP gadget library that i use for resizing. Not sure that posting a sample source makes much sense, its just a simple line "DisableGadget(Variable, 1)" and i use it a lot on buttons and the combobox i used to replace a button, is the first gadget that doesn't work flawlessly with that and with surprise i noticed that the documentation doesn't show the command in the help. So is it a documentation bug or a bug on my side or on yours even. Does it affect x86 or also x64 and what about the 5.7 beta?
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Better ComboBox gadget support

Post by Dude »

Bitblazer wrote:Not sure that posting a sample source makes much sense
Of course it makes sense, because we need to see how you're using the ComboBoxGadget() command. Is it just standard, or with supported flags like #PB_ComboBox_Editable (which changes its behavior), or even with unsupported flags like #WM_CLIPSIBLINGS? So until we know how you defined and are using it, we simply won't know why it's failing.
Bitblazer wrote:maybe its the combination with the PurevisionXP gadget library that i use for resizing
Could be. Anyway, try this code and let me know if it works:

Code: Select all

If OpenWindow(0, 200, 200, 300, 50, "ComboBox Disable Toggle", #PB_Window_SystemMenu)
  
  ComboBoxGadget(0, 10, 10, 280, 22)
  AddGadgetItem(0, -1, "This should toggle its disabled status")
  SetGadgetState(0, 0)
  
  AddWindowTimer(0, 123, 500)
  
  Repeat
    
    Event = WaitWindowEvent()
    
    If Event = #PB_Event_Timer And EventTimer() = 123
      state = 1 - state
      DisableGadget(0, state)
    EndIf    
    
  Until Event = #PB_Event_CloseWindow
  
EndIf
Bitblazer
Enthusiast
Enthusiast
Posts: 736
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Better ComboBox gadget support

Post by Bitblazer »

Your sample code actually works. I have a weird bug currently which affected the combobox. But if disablegadget on combobox is supported officially, somebody should report a documentation bug because the help does not mention it as being supported.
Post Reply