It is currently Sun Dec 16, 2018 6:30 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: BindEvent event bug
PostPosted: Tue Nov 20, 2018 8:49 pm 
Offline
Addict
Addict

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 1023
Location: Russia
When using BindEvent if click the mouse on different items of the table, the GetGadgetState function returns -1.
Code:
Procedure Ev()
   Event = Event()
    If Event = #PB_Event_Gadget
      If EventGadget() = 0
        If EventType() = #PB_EventType_Change
          Debug GetGadgetState(0)
        EndIf
      EndIf
    EndIf
EndProcedure


If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
  AddGadgetColumn(0, 1, "Address", 250)
  AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
  AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
  BindEvent(#PB_Event_Gadget, @Ev(), 0)
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Without BindEvent there is no this bug.
Code:
If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect | #PB_ListIcon_AlwaysShowSelection)
  AddGadgetColumn(0, 1, "Address", 250)
  AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
  AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
  Repeat
    Event = WaitWindowEvent()
    If Event = #PB_Event_Gadget
      If EventGadget() = 0
        If EventType() = #PB_EventType_Change
          Debug GetGadgetState(0)
        EndIf
      EndIf
    EndIf
  Until Event = #PB_Event_CloseWindow
EndIf



When using BindEvent, extra events appear with the wrong item number when clicking on checkbox in TreeGadget.
Code:
Procedure Ev()
   Event = Event()
    If Event = #PB_Event_Gadget
      If EventGadget() = 0
        If EventType() = #PB_EventType_Change
          Debug GetGadgetState(0)
        EndIf
      EndIf
    EndIf
EndProcedure


If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
  TreeGadget(0, 5, 5, 290, 90, #PB_Tree_ThreeState|#PB_Tree_CheckBoxes|#PB_Tree_AlwaysShowSelection)
  AddGadgetItem(0, -1, "Harry Rannit")
  AddGadgetItem(0, -1, "Ginger Brokeit")
 
  BindEvent(#PB_Event_Gadget, @Ev(), 0)
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Without BindEvent there is no this bug.
Code:
If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TreeGadget(0, 5, 5, 290, 90, #PB_Tree_ThreeState|#PB_Tree_CheckBoxes|#PB_Tree_AlwaysShowSelection)
  AddGadgetItem(0, -1, "Harry Rannit")
  AddGadgetItem(0, -1, "Ginger Brokeit")
 
  Repeat
    Event = WaitWindowEvent()
    If Event = #PB_Event_Gadget
      If EventGadget() = 0
        If EventType() = #PB_EventType_Change
          Debug GetGadgetState(0)
        EndIf
      EndIf
    EndIf
  Until Event = #PB_Event_CloseWindow
EndIf

_________________
Library XP_Menu_Lib - office menu; HID_Lib - USB Library
Torrent client - pbTorrent (source code); Create driver in PureBasic.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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