>> If it raised a question in your mind, I'm sure there are other people
starting out that would have the same question.

My conscious thought processes were trivial. I think I just assumed that
event-handling methods could be private, even though I knew that it's code
in ooDialog that actually invokes the method. For what it's worth, and after
a little introspection, I found that my "no-think" approach was along these
lines:
(1) I've got an event handler such as "::method doThis". 
(2) This is a public method since private isn't specified. 
(3) I don't want an event-handling method to be public. 
(4) So make it PRIVATE. 

Why did I think this could work? Well, applying some introspection, my
unconscious thought process was as follows. Being used to writing code that
runs on some "platform" or "layer", and looking on ooDialog as just such an
"underlying layer", then specifying PRIVATE should work because my code is
"above" that layer.

Of course, having surfaced that explanation, I can see how silly it is. But
I think I'll add a sentence to the Guide just in case there's a reader whose
"no-think" mode is similar to mine.

Atb,
Oliver

 

-----Original Message-----
From: Mark Miesfeld [mailto:[email protected]] 
Sent: 08 May 2012 21:41
To: Open Object Rexx Developer Mailing List
Subject: Re: [Oorexx-devel] ooDialog - Event Handlers - PRIVATE method?

On Sat, May 5, 2012 at 10:39 AM, Oliver Sims
<[email protected]> wrote:

> I just discovered that an event handler method cannot be defined as
PRIVATE.
> If it is, you get an ooDialog message saying the method name is not a 
> method of the dialog.
>
> I guess it makes sense that the underlying event-handling code cannot 
> invoke a private method. But am I correct? Or is this a bug in ooDialog?

No, it is not a bug, it is the way ooRexx works.  As you have probably
figured out in your mind.  You have an object, the ooRexx object that is
your dialog subclass.  You can only invoke public methods on that ooRexx
object.  This of course is no different than in any ooRexx
code:

  m = .Miesfeld~new
  m~fullName
  m~secretName

::class 'Miesfeld'
::method fullName
  say 'Mark Miesfeld'

::method secretName private
  say 'Mr President, sir'

The underlying ooDialog implementation code has a reference to your dialog
subclass.  It invokes the event handler by sending a message to that dialog
subclass object.  It knows the *name* of the message because you have to
specify the name, (or use the default name,) in your connectXXXEvent()
method.  If you supply a private method name, then it won't work.

C:\work.ooRexx\wc\main.4.1.fixes\samples\windows\ole\apps>qt.rex
Mark Miesfeld
     3 *-* m~secretName
Error 97 running
C:\work.ooRexx\wc\main.4.1.fixes\samples\windows\ole\apps\qt.rex line
3:  Object method not fou
nd
Error 97.1:  Object "a Miesfeld" does not understand message "SECRETNAME"


> If it's correct, then it would be useful (imho) to mention it in 
> section 4.7.1."Coding Event Handlers".
> And if it's correct I'll certainly put a mention in the Guide.

Sure, it's worth mentioning.  If it raised a question in your mind, I'm sure
there are other people starting out that would have the same question.

--
Mark Miesfeld

----------------------------------------------------------------------------
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat
landscape has changed and how IT managers can respond. Discussions will
include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to