It is currently Tue Apr 07, 2020 12:35 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 37 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Aug 23, 2017 7:19 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 845
Location: Denmark
gurj wrote:
because this bug,I now use:
updated:
Code:
    OpenWindow(0,0,0,300,100,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
    LoadFont(0,"system", 12):SetGadgetFont(#PB_Default, FontID(0))
    StringGadget(3, 5, 5, 80, 25,"")
    ComboBoxGadget(0, 5, 30, 80, 25)
    AddGadgetItem(0,-1,"100")
    AddGadgetItem(0,-1,"200")

    ButtonGadget(1, 85, 0,200, 25, "<+1")

    Repeat
      ev=WaitWindowEvent()
      Select ev
        Case #PB_Event_Gadget:eg=EventGadget()
         Select eg
           Case 0;:If EventType()=#PB_EventType_Change
          SetGadgetText(3,GetGadgetText(0));:EndIf
            Case 1
              SetGadgetText(3,Str(Val(GetGadgetText(3)) + 1))
          EndSelect
        Case #PB_Event_CloseWindow
          Break
      EndSelect
    ForEver
    End




@gurj

Rephasing:
Currently it is a coding question!
ComboBoxgadget has the same behaviour in 5.44 and up.
We'll let the team decide if this is a bug or not.

Have a nice day.

Code:
OpenWindow(0, 0, 0, 120, 50, "Combo_edit", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
combo = ComboBoxGadget(#PB_Any, 0, 10, 50, 30, #PB_ComboBox_Editable)
button = ButtonGadget(#PB_Any, 55, 10, 50, 30, "+")
AddGadgetItem(combo, -1, "")
AddGadgetItem(combo, -1, "100")
AddGadgetItem(combo, -1, "200")

Repeat
 
  ev = WindowEvent()
 
  Select ev
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_Gadget
      If EventGadget() = button
        Select GetGadgetState(combo)
          Case -1
            num.i = Val(GetGadgetText(combo)) + 1
            SetGadgetText(Combo, Str(num))
          Case 0
            num.i = Val(GetGadgetItemText(combo, 0)) + 1
            SetGadgetItemText(combo, 0, Str(num))
          Default
          SetGadgetItemText(combo, 0, "")
          num.i = Val(GetGadgetText(combo)) + 1
          SetGadgetItemText(combo, GetGadgetState(combo), Str(num))
        EndSelect
      EndIf
   EndSelect         
ForEver

_________________
“Tell me and I forget. Teach me and I remember. Involve me and I learn.”
— Benjamin Franklin
Current configurations: Windows 10, Intel 6800K, GeForce Gtx 1060, 32 gb ram.


Last edited by DK_PETER on Wed Aug 23, 2017 8:14 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Aug 23, 2017 7:49 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
who can try pb5.41 and 5.42 ?
after pb 5.41,start has this bug from pb5.42 ?

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Aug 23, 2017 8:23 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
is bug,try this:
; first let Gadget_0 state To 1 [by Select Box List only]
; click "Button 1" 1 time...
; why Item_2<>"201" ?
; why Item_2<>Editable ?
Code:
; first let Gadget_0 state To 1  [by Select Box List only]
;   click "Button 1" 1 time...
; why Item_2<>"201" ?
; why Item_2<>Editable ?

OpenWindow(0,0,0,300,100,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
LoadFont(0,"system", 12):SetGadgetFont(#PB_Default, FontID(0))
ComboBoxGadget(0, 5, 5, 80, 25, #PB_ComboBox_Editable)
AddGadgetItem(0,-1,"100")
AddGadgetItem(0,-1,"200")

ButtonGadget(1, 85, 0,200, 25, "Button 1")

Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
    Case 1:SetGadgetText(0,Str(1+Val(GetGadgetText(0))))
     AddGadgetItem(0,-1,GetGadgetText(0))
     
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Aug 23, 2017 8:40 am 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1110
Location: Gernsbach (Germany)
gurj wrote:
bug on:

DK_PETER wrote:
It's not a bug.

gurj wrote:
now pb bug is :

DK_PETER wrote:
No bug. :wink:

gurj wrote:
is bug!


:lol:

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Aug 23, 2017 11:24 pm 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1143
Location: Germany
Confirmed with 5.60

It has something todo when the editable combobox has the focus in it :wink:

BR Klaus


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Thu Aug 24, 2017 12:40 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
first let Gadget_0 state To 1 [by Select Box List only]
click "Button 1" 1 time...
must open List To look,but Not Select
[why Item_2<>"201" ?
why Item_2<>Editable ?]

then close List
again click "Button 1" 1 time...
why Editable="1" ?
must open List To look,but Not Select
again click "Button 1" 1 time...
why Editable="100" ?
...

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Sun Aug 27, 2017 7:37 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
but can use As this:
Code:
OpenWindow(0,0,0,400,100,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
LoadFont(0,"system", 12):SetGadgetFont(#PB_Default, FontID(0))
ButtonGadget(0, 100, 0,200, 20, "<+1")
ComboBoxGadget(1,0,0,99,22,#PB_ComboBox_Editable )
AddGadgetItem(1,-1,"100")
AddGadgetItem(1,-1,"200")
Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
     Case 0:gs=GetGadgetState(1):If gs>-1
      s.s=Str(Val(GetGadgetItemText(1,gs))+1):SetGadgetState(1,-1):SetGadgetText(1,s)
      AddGadgetItem(1,-1,s); s: not use GetGadgetText(1)) here
      Else
      SetGadgetText(1,Str(Val(GetGadgetText(1))+1)):AddGadgetItem(1,-1,GetGadgetText(1))
      EndIf
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Mon Sep 04, 2017 5:17 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
I try pb5.41,it no this bug.
ok, 5.41

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Sep 05, 2017 4:00 am 
Offline
User
User
User avatar

Joined: Wed Jan 16, 2008 11:28 am
Posts: 84
Location: china
Yes!, it a bug with pb5.60, because in delphi and another language, there had no this wrong, but use pb5.31 ,it was no this wrong too.

please look at this code :
Code:
OpenWindow(0,0,0,300,100,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
LoadFont(0,"system", 12):SetGadgetFont(#PB_Default, FontID(0))
ComboBoxGadget(0, 5, 5, 80, 25, #PB_ComboBox_Editable)
AddGadgetItem(0,-1,"100")
AddGadgetItem(0,-1,"200")

ButtonGadget(1, 85, 0,200, 25, "Button 0")

Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
      Case 1:
         MessageRequester("index:"+Str(GetGadgetState(0)),GetGadgetText(0))
         SetGadgetText(0,Str(1+Val(GetGadgetText(0))))
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End

_________________
Diamond Sutra: all law I was into at, forbearance .
http://www.8do8.com


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Sep 05, 2017 7:12 am 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8048
Location: Fort Nelson, BC, Canada
It is a bug. If the value applied to the gadget via SetGadgetText() exists in the dropdown list then SetGadgetText() should also update the gadget state. This would mirror the behavior of the non-editable version of the gadget, which seems to work correctly. Note that the state should only be updated if the value currently exists in the dropdown, otherwise -1 (none selected) is the correct state.

In this code the state should be updating because the values exist in the dropdown, however this isn't happening:
Code:
Declare CBProc()

OpenWindow(0,0,0,300,100,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
ComboBoxGadget(0, 5, 5, 80, 25, #PB_ComboBox_Editable)
; ComboBoxGadget(0, 5, 5, 80, 25) ; <========================= Uncomment this line and see the difference
For i=1 To 10
  AddGadgetItem(0, -1, Str(i))
Next
ButtonGadget(1, 85, 0, 200, 25, "Button 0")
BindGadgetEvent(1, @CBProc())

Repeat: EventID=WaitWindowEvent():Until EventID=#PB_Event_CloseWindow

Procedure CBProc()
  SetGadgetText(0,Str(1+Val(GetGadgetText(0))))
  Debug GetGadgetState(0)
EndProcedure

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Sep 06, 2017 2:17 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
ComboBoxGadget() bug To pbIDE's Find/Replace bug
also try line6 to ComboBoxGadget(1, 105, 0, 305, 25);,#PB_ComboBox_Editable)
Code:
;ComboBoxGadget() bug To pbIDE's Find/Replace bug
;also try line6 to ComboBoxGadget(1, 105, 0, 305, 25);,#PB_ComboBox_Editable)

OpenWindow(0, 0, 0, 415, 140, "Find", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(0, 30, 5, 70, 25, "Search for:")
ComboBoxGadget(1, 105, 0, 305, 25,#PB_ComboBox_Editable)
ButtonGadget(2, 5, 110, 100, 25, "Find Next")

For a=0 To 3
 AddGadgetItem(1,a,Str(a))
Next
SetGadgetText(1,"-1")

g1=GetGadgetState(1)
Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
     
    Case 1:g1=GetGadgetState(1)
     
    Case 2:g1s.s= GetGadgetText(1)
     If g1>-1
      RemoveGadgetItem(1,g1)
      AddGadgetItem(1,0,g1s)
     
     Else
      For a=0 To CountGadgetItems(1)-1
       If GetGadgetItemText(1,a)=g1s
        RemoveGadgetItem(1,a)
        AddGadgetItem(1,0,g1s):Break
       EndIf
      Next
      If a=CountGadgetItems(1)
       If CountGadgetItems(1)<7
        AddGadgetItem(1,0,g1s)
       EndIf
      EndIf
     EndIf
     
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Sep 06, 2017 2:30 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
ComboBoxGadget() bug To pbIDE's Find/Replace bug
try pb 4.61 and 5.60 and 5.41 ,all has bug

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Sep 06, 2017 3:21 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
ComboBoxGadget() bug To pbIDE's Find/Replace bug
line25 add SetGadgetState(1,0),updated,ok,no wrong:
Code:
;ComboBoxGadget() bug To pbIDE's Find/Replace bug
;also try line6 to ComboBoxGadget(1, 105, 0, 305, 25);,#PB_ComboBox_Editable)
;line25 add SetGadgetState(1,0),ok
OpenWindow(0, 0, 0, 415, 140, "Find", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(0, 30, 5, 70, 25, "Search for:")
ComboBoxGadget(1, 105, 0, 305, 25,#PB_ComboBox_Editable)
ButtonGadget(2, 5, 110, 100, 25, "Find Next")

For a=0 To 3
 AddGadgetItem(1,a,Str(a))
Next
SetGadgetText(1,"-1")

g1=GetGadgetState(1)
#max=7
Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
     
    Case 1:g1=GetGadgetState(1)
     
    Case 2:g1s.s= GetGadgetText(1)
     If g1s<>""
      ;find in ... here, add your codes
      b=CountGadgetItems(1)
      AddGadgetItem(1,0,g1s)
      If g1>-1
       RemoveGadgetItem(1,g1+1)
       SetGadgetState(1,0);:g1=0
      Else
       For a=1 To b
        If GetGadgetItemText(1,a)=g1s
         RemoveGadgetItem(1,a):Break
        EndIf
       Next
       If a>#max;a=b+1 And
         RemoveGadgetItem(1,#max)
       EndIf
      EndIf
     EndIf
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End

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


Last edited by gurj on Thu Sep 07, 2017 2:13 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Wed Sep 06, 2017 7:32 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1769
Definitely a bug.
Though I think it's a GetGadgetText() bug, not a SetGadgetText() bug.

Here, GetGadgetText() is returning an old string "1" when the gadget clearly shows "2".
PB 5.60 x86 on Windows 7

Code:
OpenWindow(0,300,300,300,100,"",#PB_Window_SystemMenu)

ComboBoxGadget(0, 5, 5, 80, 25, #PB_ComboBox_Editable)
AddGadgetItem(0, 0, "1")

ButtonGadget(1, 85, 0,200, 25, "Click to increase value +1")

TextGadget(2, 5, 35, 240, 60, "1. Click button a few times" + #LF$ + "2. Select 1 from dropdown" + #LF$ + "3. Click button a few times")

Repeat
  ev=WaitWindowEvent()
  If ev=#PB_Event_Gadget And EventGadget()=1
    SetGadgetText(0,Str(Val(GetGadgetText(0))+1))
    Debug "GadgetText = " + GetGadgetText(0)
  EndIf
Until ev=#PB_Event_CloseWindow

_________________
On GitHub: PB Includes - IDE Tools - Color Themes


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Thu Sep 07, 2017 2:10 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 616
Location: china
ok,no wrong,this:
Code:
;ok,no wrong
OpenWindow(0,0,0,300,100,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
LoadFont(0,"system", 12):SetGadgetFont(#PB_Default, FontID(0))
ComboBoxGadget(0, 5, 5, 80, 25, #PB_ComboBox_Editable)
AddGadgetItem(0,-1,"100")
AddGadgetItem(0,-1,"200")

ButtonGadget(1, 85, 0,200, 25, "Button 1")
SetGadgetState(0,0)

Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
    Case 1:g0s.s=Str(1+Val(GetGadgetText(0)))
     SetClipboardText(g0s)
     SetActiveGadget(0)
     ;SendMessage_(GadgetID(0),#EM_REPLACESEL,0,g0s)
     keybd_event_(#VK_CONTROL,0,0,0)
     keybd_event_(#VK_V,0,0,0)
     keybd_event_(#VK_V,0,#KEYEVENTF_KEYUP,0)
     keybd_event_(#VK_CONTROL,0,#KEYEVENTF_KEYUP,0)
     AddGadgetItem(0,-1,g0s)
   EndSelect
   
  Case #PB_Event_CloseWindow:Break
EndSelect:ForEver
End

_________________
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  [ 37 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 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