From: <os...@si...> - 2011-06-16 22:41:11
|
> The getCaretPos() method is a method I wrote in the example program, it is a method I added to my dialog subclass. Doh! Sorry - I should have spotted that... Ref methods on control vs on dialog - maybe the principle is, always look first in the control documentation. Many thx, Oliver -----Original Message----- From: Mark Miesfeld [mailto:mie...@gm...] Sent: 16 June 2011 22:19 To: Open Object Rexx Users Subject: Re: [Oorexx-users] ooDialog - getCaretPos On Thu, Jun 16, 2011 at 3:31 PM, <os...@si...> wrote: > Working through the detail of your numeric check of data in an edit > control, I noticed that the "getCaretPos" method is not in build 6965 > of the ooDialog ref. I checked in several of the source files, but > couldn't find it. Can you tell me please which ooDialog source file I should look in? > > The statement in your EditDecs file (in the 'onUpdate' method) was: > pos = self~getCaretPos(ecDecNum2) - 1 The getCaretPos() method is a method I wrote in the example program, it is a method I added to my dialog subclass. ::method getCaretPos private > Btw, I wondered why this is not a method on the edit control itself > rather than on the dialog. It is not a method of the .Edit class because the Windows API used with Edit controls does not have such a method. That doesn't mean the method couldn't be added to the .Edit class, it just means no has thought to do so, as of yet. In the Windows API, the EM_GETSEL edit control message is defined as: "Gets the starting and ending character positions of the current selection" and in the Remarks section of the Windows documentation for that message it says: If there is no selection, the starting and ending values are both the position of the caret. So, that is a relatively simple way to get the character position of the caret, and is what I used. However, it is not foolproof. If you do have a selection, the caret will be either at the end of the selection, or the front of the selection - depends on if you selected from right to left or from left to right. > This is an area that seems a little confusing. Is there a principle I > can apply to predict whether a method is on a control object or on a > dialog object? In general there is no principle here. This was confusing I think because you didn't notice that I had defined the method in my program. In general, at this point in ooDialog, I don't think there are any methods for controls that are defined on the dialog object, that don't have a matching method in the control itself. My personal belief is that during the history of ooDialog too many methods were added to the dialog object, that did not belong to a dialog object. Among these are methods like getListWidth and setListWidth that set or get a list box width. I never use methods of the dialog object that should be dialog control methods. If I need to do something with a dialog control, I use a dialog control object. -- Mark Miesfeld ---------------------------------------------------------------------------- -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Oorexx-users mailing list Oor...@li... https://lists.sourceforge.net/lists/listinfo/oorexx-users |