It is currently Sun Jul 21, 2019 12:06 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 37 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: [Done] bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 5:17 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
bug,SetGadgetText(#ComboBox_1,s.s)

first click ButtonG_"+>" 5 times, all ok

then let Gadget1 state To 1(any>-1)
click ButtonG_"+>" 1 times, ok
again click ButtonG_"+>",No
pb5.6 winxp x86 has this bug.
but old pb4.61 no bug.

Code:
OpenWindow(0, 0, 0, 440, 160, "", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
LoadFont(0,"System", 12, #PB_Font_Bold):SetGadgetFont(#PB_Default, FontID(0))
ComboBoxGadget(1, 165, 110, 195, 25, #PB_ComboBox_Editable)

ComboBoxGadget(5, 5, 110, 80, 25)
AddGadgetItem(5,-1,"1ms")
AddGadgetItem(5,-1,"1sec")
AddGadgetItem(5,-1,"1min")
AddGadgetItem(5,-1,"1hour")
AddGadgetItem(5,-1,"1day")
AddGadgetItem(5,-1,"1mon")
AddGadgetItem(5,-1,"1year")
AddGadgetItem(5,-1,"4year")
AddGadgetItem(5,-1,"100year")
AddGadgetItem(5,-1,"400year")
Dim t.q(9):t(0)=1
t(1)=1000
t(2)=60000
t(3)=3600000
t(4)=86400000
t(5)=2592000000
t(6)=31536000000
t(7)=126230400000
t(8)=3155673600000
t(9)=12622780800000

ButtonGadget(7, 85, 110, 40, 23, "+>")
ButtonGadget(8, 125, 110, 40, 23, "->")
AddGadgetItem(1,-1,"-9223")
AddGadgetItem(1,-1,"9223")

Repeat:ev=WaitWindowEvent():Select ev
  Case #PB_Event_Gadget:eg=EventGadget()
   Select eg
     Case 5:g5t.a=GetGadgetState(5)
     Case 7:g1s.s=Str(Val(GetGadgetText(1))+t(g5t)):SetGadgetText(1,g1s)
     Case 8:SetGadgetText(1,Str(Val(GetGadgetText(1))-t(g5t)))
   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: Tue Aug 22, 2017 5:41 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
bug on:
If Gadget1 state >-1
GetGadgetText(1) == GetGadgetItemText(1,Gadget1 state)

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


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

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
I guessing involve and this:
[5.42] Replace by using old replace phrase fails...
viewtopic.php?f=4&t=65153

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


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

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
tiny code to try:
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:SetGadgetText(0,Str(1+Val(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: Tue Aug 22, 2017 9:04 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
Is this what you're after?

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
          nextvalue.i = Val(GetGadgetText(0)) + 1
          SetGadgetItemText(0,GetGadgetState(0), Str(nextvalue))
      EndSelect
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
End

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


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

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
thanks.
not allow change Gadget_0 Item

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 9:38 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
gurj wrote:
thanks.
not allow change Gadget_0 Item


True..The value has to be added to the combo before any addition can be made..

In the example below, I've used a keyboard shortcut to capture the return key.
It added the typed value and selects it for further handling.

Code:
OpenWindow(0,0,0,300,100,"",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
CreatePopupMenu(0)
MenuItem(2, "DummyItem")
LoadFont(0,"system", 12):SetGadgetFont(#PB_Default, FontID(0))
ComboBoxGadget(0, 5, 5, 80, 25, #PB_ComboBox_Editable)
AddKeyboardShortcut(0,#PB_Shortcut_Return, 2)
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
          nextvalue.i = Val(GetGadgetText(0)) + 1
          SetGadgetItemText(0,GetGadgetState(0), Str(nextvalue))   
      EndSelect
        Case #PB_Event_Menu
          AddGadgetItem(0, -1, GetGadgetText(0))
          SetGadgetState(0, CountGadgetItems(0)-1)
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
End

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 9:56 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
because this bug,I now use:
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


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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 10:17 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
@gurj

It's not a bug. The gadget state is -1 at first, which is as expected.

The example uses:

Code:
SetGadgetItemText(0, GetGadgetState(0), Str(nextvalue))


edit: rephasing
to place the incremented value back in it's place.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 11:06 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
no,no, ComboBoxGadget's Editable has bug,so i use StringGadget here.

now pb bug is :
If Gadget_0 state >-1 [by select Box list only]
then if user Edit ComboBoxGadget's Editable,Gadget_0 state = -1
but if by command Edit ComboBoxGadget's Editable,Gadget_0 state remain >-1 ,this is wrong!!!

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 11:38 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
ComboBoxGadget's Editable is Gadget's state = -1 when Edited.
and irrelevant ComboBoxGadget's state,should can G[S]etGadgetText(#ComboBox_1) for ComboBoxGadget's Editable
------
other, i also hope use G[S]etGadgetItemText(#ComboBox_1,-1) for ComboBoxGadget's Editable
this can =
G[S]etGadgetText(#ComboBox_1)
sorry my bad english.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 12:38 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Feb 19, 2011 10:06 am
Posts: 771
Location: Denmark
No bug. :wink:

Change this to your fit your needs:

Code:
Global ComboIndex.i = -1
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
          If GetGadgetState(0) = -1 And GetGadgetText(0) <> ""
            nextvalue = Val(GetGadgetText(0))+1
            AddGadgetItem(0, -1, Str(nextvalue))
            SetGadgetItemText(0,GetGadgetState(0), Str(nextvalue))   
            ComboIndex = CountGadgetItems(0)-1
            SetGadgetState(0, ComboIndex)
          Else
            nextvalue.i = Val(GetGadgetText(0)) + 1
            ComboIndex = GetGadgetState(0)
            SetGadgetItemText(0, ComboIndex, Str(nextvalue))   
          EndIf
      EndSelect

    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
End

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 12:47 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1893
Not a bug. Just a problem with the logic of the code. Here's proof that it works:

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

ComboBoxGadget(0, 5, 5, 80, 25, #PB_ComboBox_Editable)

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

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


Top
 Profile  
Reply with quote  
 Post subject: Re: bug,SetGadgetText(#ComboBox_1,s.s)
PostPosted: Tue Aug 22, 2017 1:10 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
is bug!
first let ComboBoxGadget_0 state>-1 [by select Box list only]
then SetGadgetText(0,s.s)
then you can't ture GetGadgetText(0), so:
Editable nonprofit, Editable invalid, Editable not worth

_________________
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 5:58 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 22, 2009 3:48 am
Posts: 587
Location: china
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


_________________
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 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

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