1. Win32lib question - can I tell the calling control?
- Posted by John Coonrod <jc at THP.ORG> Aug 14, 2000
- 614 views
Let's say I set the onClick event for a dozen different controls to the same procedure. Is there a way that this procedure can find out the handle for the calling control?
2. Re: Win32lib question - can I tell the calling control?
- Posted by David Cuny <dcuny at LANSET.COM> Aug 14, 2000
- 654 views
John Coonrod wrote: > Is there a way that this procedure can find out > the handle for the calling control? The getSelf() routine should work. -- David Cuny
3. Re: Win32lib question - can I tell the calling control?
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Aug 14, 2000
- 658 views
> From: John Coonrod > Let's say I set the onClick event for a dozen different > controls to the same > procedure. > Is there a way that this procedure can find out the handle > for the calling > control? No, since onClick (a la win32lib) doesn't pass any parameters. I'd suggest changing the routine you have to accept the id, and creating other procedures to 'wrap' it: procedure all_onClick( integer id ) if id = Control1 then ... elsif ... ... end if ... end procedure procedure Control1_onClick() all_onClick( Control1 ) end procedure onClick[Control1] = routine_id("Control1_onClick") etc... Matt Lewis
4. Re: Win32lib question - can I tell the calling control?
- Posted by Matthew Lewis <MatthewL at KAPCOUSA.COM> Aug 14, 2000
- 630 views
> -----Original Message----- > From: David Cuny > > The getSelf() routine should work. Aha. That would explain the use of push/popSelf [in WndProc/SubProc]. I've often wondered about that. Also, getSelf isn't in the docs, which explains why I never found it. 3 lines of code in 17,000, sheesh. :) Matt
5. Re: Win32lib question - can I tell the calling control?
- Posted by "Cuny, David at DSS" <David.Cuny at DSS.CA.GOV> Aug 14, 2000
- 560 views
Matthew Lewis wrote: > Aha. That would explain the use of push/popSelf > [in WndProc/SubProc]. I've often wondered about that. That was one fun weekend, getting that worked out. My initial cut just used a single variable to keep track of self. I found out the hard way that a callback (such as an onPaint) can trigger at any time, and when you return, self has been mangled. Using a stack to keep track of the state takes care of that problem. > Also, getSelf isn't in the docs, which explains > why I never found it. 3 lines of code in 17,000, > sheesh. :) *blush* Yet another minor detail to add to the list... -- David Cuny