It is currently Wed Oct 23, 2019 7:54 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: QtScript TreeGadget events
PostPosted: Sun Mar 17, 2019 11:44 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Dec 29, 2011 5:03 pm
Posts: 472
Hi,

How can we determine which item the event is from? GetGadgetState() doesn't return the right position in all cases.
Code:
Runtime Procedure QtSignalHandler()
  MessageRequester("", "Item collapsed")
EndProcedure 

If OpenWindow(0, 0, 0, 320, 250, "FrameGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  TreeGadget(0, 10,  10, 300, 230)
 
  AddGadgetItem(0, -1, "Folder")
  AddGadgetItem(0, -1, "Item", 0, 1)
  AddGadgetItem(0, -1, "Folder", 0, 1)
  AddGadgetItem(0, -1, "Item", 0, 2)
  AddGadgetItem(0, -1, "Item", 0, 0)
 
  Define i
  For i = 0 To CountGadgetItems(0) - 1
    If GetGadgetItemText(0, i) = "Folder"
      SetGadgetItemState(0, i, #PB_Tree_Expanded)
    EndIf
  Next
 
  QtScript(~"gadget(0).itemCollapsed.connect(function() { runtime.call(\"QtSignalHandler()\"); })")   
 
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


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