It is currently Wed Oct 23, 2019 8:03 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: ComboBoxGadget's State bug
PostPosted: Tue Apr 16, 2019 5:13 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 596
Location: china
ComboBoxGadget's State bug
For ComboBoxGadget,I think the correct logic:

1 If Select a Item Or SetGadgetState(),
the Item's id will=the ComboBoxGadget's State.
And the Item's text will=the Gadget's current text . [To GetGadgetText()]
2 If SetGadgetState(#Gadget,-1),State will=-1. [To GetGadgetState()]
And the Gadget's current text will not change,
And the Gadget's current text will =Item(-1)'s text
3 If Gadget's current text changed, and not from [Select a Item Or SetGadgetState()],
And from [input Or paste Or SetGadgetText()]
State will=-1.
----------
[input Or paste] To Gadget's current text will change,
And State will=-1,obviously Gadget's current text=Item(-1)'s text
;FIXME :
;but first bug:
SetGadgetState(#Gadget,-1),current text will change To ""
also see
say State of ComboBoxGadget
http://www.purebasic.fr/english/viewtop ... =3&t=69190
ComboboxG's 'BUG', when use #PB_ComboBox_Editable
viewtopic.php?f=4&t=72053
EventGadget() bug:when ComboBoxGadget is clicked
http://www.purebasic.fr/english/viewtop ... 13&t=66666

ComboBoxGadget's State bug [Not all bug Example] see:
Code:
OpenWindow(0,0,0,300,100,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
LoadFont(0,"system", 12):SetGadgetFont(#PB_Default, FontID(0))

ComboBoxGadget(0, 5, 5, 80, 25)
AddGadgetItem(0,-1,"100")
AddGadgetItem(0,-1,"200")
SetGadgetState(0,1); State will=1 ,this ok
ButtonGadget(2, 85, 0,200, 25, "test")
;use Editable:
ComboBoxGadget(1, 5, 35, 80, 25, #PB_ComboBox_Editable)
AddGadgetItem(1,-1,"300")
AddGadgetItem(1,-1,"400")
SetGadgetState(1,1); State will=1 ,this ok
ButtonGadget(3, 85, 30,200, 25, "test")

Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
    Case 2,3:comb=eg-2
     s.s=Str(1+Val(GetGadgetText(comb)))
     SetGadgetText(comb,s)
     ;FIXME :
     ;if comb=0 no use Editable, SetGadgetText() invalid, this is a bug
     Debug GetGadgetState(comb)
     ;FIXME :
     ;if comb=1 use Editable,State will=1, this is a bug,should =-1
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End

; IDE Options = PureBasic 5.71 beta 1 LTS (Windows - x86)
; Folding = -
; EnableXP
; EnableUnicode

_________________
my pb for chinese:
http://ataorj.ys168.com


Top
 Profile  
Reply with quote  
 Post subject: Re: ComboBoxGadget's State bug
PostPosted: Tue Apr 16, 2019 10:35 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 596
Location: china
no use 'Editable', Getgadget is read-only, but this is just for Ordinary Users ,in Program Can Still Edit IT. Just like this:

StringGadget(2, 8, 60, 306, 20, "Read-only", #PB_String_ReadOnly)
SetGadgetText(2,"who say Read-only?")

Similarly, you can do this:

ComboBoxGadget(1, 5, 35, 80, 25)
SetGadgetText(1,"Please choose:")
AddGadgetItem(1,-1,"Read-only")
AddGadgetItem(1,-1,"Edit")

_________________
my pb for chinese:
http://ataorj.ys168.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye