It is currently Tue Jun 02, 2020 3:15 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: How to detect double click on TextGadget()?
PostPosted: Tue Oct 08, 2019 7:00 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3609
Location: Netherlands
Here's another way of detecting the enter inside a StringGadget .
It's a more universal way you can use for every Target/Action .
Code:
Prototype Proto_SendAction(Object, Selector, Action, Target, Sender)
DeclareC SendAction(Object, Selector, Action, Target, Sender)

Global SendAction_.Proto_SendAction = class_replaceMethod_(objc_getClass_("NSApplication"),
                                                           sel_registerName_("sendAction:to:from:"),
                                                           @SendAction(), "c@::@@")

Global StringGadgetClass

ProcedureC SendAction(Object, Selector, Action, Target, Sender)
 
  Select object_getClass_(Sender)
    Case StringGadgetClass
      Debug "Enter by StringGadget: " + Str(CocoaMessage(0, Sender, "tag"))
  EndSelect
   
  If SendAction_
    ProcedureReturn SendAction_(Object, Selector, Action, Target, Sender)
  EndIf
EndProcedure


OpenWindow(0, 270, 100, 200, 170, "Target/Action", #PB_Window_MinimizeGadget)
StringGadget(1, 10, 10, 100, 20, "Gadget 1")
StringGadget(2, 10, 40, 100, 20, "Gadget 2")
StringGadget(3, 10, 70, 100, 20, "Gadget 3")

StringGadgetClass = object_getClass_(GadgetID(1))

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow

_________________
macOS 10.15 Catalina, PB 5.71 x64


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

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