Article View: comp.windows.interviews
Article #756Re: Client data in callbacks?
From: Don Walters
Date: Mon, 05 Oct 1992 23:47
Date: Mon, 05 Oct 1992 23:47
17 lines
1473 bytes
1473 bytes
> Is it possible to pass client data thru a callback? For example, I have (say) > 20 buttons, each with almost identical behavior. I'd like to write one callback > and pass client data to the callback which identifies which button was pressed. > I know I could subclass a button, but I'd prefer to use the existing kit's buttons. > I could also wrap the button returned by the kit in a monoglyph with a field > that identifies its contents, but that seems kinda like a kludge. > Any suggestions? I'm not sure I understood your application totally, but the easiest way I have found to accomplish this is to subclass the Action class. You then create a unique instance of your Action subclass for each desired behavior. You would provide arguments to your constructor to set the parameter that should be sent to the application. And of course your subclass would override the "execute" method so your application gets called with the parameter. Don daw@zuken.com
Technical Details
Message-ID:
<9210052346.AA04671@sc.zuken.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!att-out!rutgers!sun-barr!ames!agate!stanford.edu!sc.zuken.com!dawReferences:
<9210052151.AA11188@espresso.bcs.eca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!att-out!rutgers!sun-barr!ames!agate!stanford.edu!sc.zuken.com!daw From: daw@sc.zuken.com (Don Walters) Newsgroups: comp.windows.interviews Subject: Re: Client data in callbacks? Message-ID: <9210052346.AA04671@sc.zuken.com> Date: 5 Oct 92 23:47:03 GMT References: <9210052151.AA11188@espresso.bcs.eca> Sender: news@shelby.stanford.edu (USENET News System) Organization: Internet-USENET Gateway at Stanford University Lines: 17