|
Brian, I noticed that the two find macros are very similar. You could just have one macro which takes a parameter to indicate to use LP_FINDCHANGE or LP_FINDSEL (then you only have one file to maintain). In your profile.lx, you would specify the parameter on the Ctrl+F and Ctrl+N settings. 'set action.c-f MACRO MYFIND' 'set action.c-n MACRO MYFIND NEXT' You might want to not call your macro 'FIND'. By doing so, any other macro that tries to use the editor 'FIND' command will be calling your macro and might not get the expected results. Eric Simpson WebSphere Development Tools for iSeries IBM Canada Lab - D1/140/8200/MKM Phone: (905) 413-3226, Tie-Line: 969-3226, Fax: (905) 413-4850 Email: esimpson@ca.ibm.com "Brian D. James" <bjames@isdsolutions.net>@midrange.com on 11/27/2001 08:43:36 AM Please respond to code400-l@midrange.com Sent by: code400-l-admin@midrange.com To: "Code400" <CODE400-L@midrange.com> cc: Subject: Workaround for <Ctrl+F> and <Ctrl+N> In an earlier post, I expressed a desire to have the <Ctrl+F> FINDCHANGE function be able to detect a selected text string and to automatically find the next occurrence of that selected text string or if no selected text was found to display the dialog box for entry of a text string. Thanks to Barry Hoffman for pointing out the LP_FINDSEL command to me, I was able to come up with the following workaround to achieve the results I wanted. First I created a macro called FIND.LX that consists mainly of the following lines. 'extract blockstart' /* find start position of block highlight */ 'extract blockend' /* find end position of block highlight */ 'extract blockdoc' /* block in document */ 'extract docnum' /* current document */ /* determine if any text selected and if not display the find/change dialog */ if (blockstart = 0 | blockend = 0 | blockend < blockstart | blockdoc <> docnum) then do 'LP_FINDCHANGE' /* Otherwise, find the next occurrence of the selected text */ else do 'LP_FINDSEL' exit 0 Then, I modified my profile.lx file to tie this macro to <Ctrl+F> as follows. 'set action.c-f MACRO FIND' These modifications achieved the results I wanted but I found that I actually preferred to have this same functionality on the <CTRL+N> shortcut key so I created another macro called FINDNEXT.LX. 'extract blockstart' /* find start position of block highlight */ 'extract blockend' /* find end position of block highlight */ 'extract blockdoc' /* block in document */ 'extract docnum' /* current document */ /* determine if any text selected and if not, find the next occurrence of the previously */ /* selected text */ if (block start = 0 | blockend = 0 | blockend < blockstart | blockdoc <> docnum) then do 'LP_FINDNEXT' /* Otherwise, find the next occurrence to the selected text. */ else do 'LP_FINDSEL' exit 0 Then, I modified my profile.lx file to tie this macro to <Ctrl+N>. 'set action.c-n MACRO FINDNEXT' By using <Ctrl+T,N> then successive <Ctrl+N>'s I can efficiently select a format name or variable name and then jump down through the code to the next occurrence of that name without having to take my hands off the keyboard. Regards, Brian _______________________________________________ This is the CODE/400 Discussion & Support (CODE400-L) mailing list To post a message email: CODE400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/code400-l or email: CODE400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/code400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.