Rectangle Selection Mode

Help with writing and playing macros

Rectangle Selection Mode

Postby jmepatterson » Tue Aug 17, 2004 8:29 am

Is there a way to write a macro to allow the user to enter into a rectangle selection mode? What I want to do is activate Column Mode and allow the cursor movements to select text until an edit action (Cut, Copy, ESC, ...). Any suggestions?
User avatar
jmepatterson
Newbie
 
Posts: 4
Joined: Mon Aug 16, 2004 11:00 pm

Re: Rectangle Selection Mode

Postby Mofi » Tue Aug 17, 2004 9:24 am

Why do you need a macro for this?

Simply change to column mode and move the cursor while pressing the SHIFT key to select the text. Moving the cursor while SHIFT is pressed always selects in any windows program and everywhere.

To change column mode on/off quickly, assign a hotkey for it and/or add "Column Mode" to the toolbar.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Rectangle Selection Mode

Postby mrainey56 » Tue Aug 17, 2004 9:30 am

If you did want a macro to do this, here's a very simple example of selecting and cutting out a rectangle. You could do things like make decisions based on what the current character was (IfCharIs). Might or might not be worth the effort.


InsertMode
ColumnModeOff
HexOff
UnixReOn
ColumnModeOn
StartSelect
Loop 5
Key RIGHT ARROW
Key DOWN ARROW
EndLoop
Cut
User avatar
mrainey56
Master
Master
 
Posts: 212
Joined: Tue Jul 27, 2004 11:00 pm
Location: Spartanburg, South Carolina

Re: Rectangle Selection Mode

Postby jmepatterson » Tue Aug 17, 2004 9:51 am

Thanks guys. I need this macro to simulate functionality found in BRIEF. The example macro above has a set number of cursor movements but I need to just turn on a selection mode allowing arbitrary highlighting. Imagine the user hitting Ctrl-c and then down and over some number of characters, then "+" (the BRIEF copy key stroke). Does this make sense?
Thanks...
User avatar
jmepatterson
Newbie
 
Posts: 4
Joined: Mon Aug 16, 2004 11:00 pm

Re: Rectangle Selection Mode

Postby mrainey56 » Tue Aug 17, 2004 11:25 am

I'm not sure I completely understand, but I'm sort of with our Austrian friend in that it seems like you could easily do what you want using only the mouse:

click a toolbar icon - Column Mode On
select your text with the mouse
click a toolbar icon or use context menu - Copy
click a toolbar icon - Column Mode Off
click anywhere to deselect

The last three clicks could be made into one (no toolbar icon for macros, though) or assigned to a keystroke by using a macro.
User avatar
mrainey56
Master
Master
 
Posts: 212
Joined: Tue Jul 27, 2004 11:00 pm
Location: Spartanburg, South Carolina

Re: Rectangle Selection Mode

Postby jmepatterson » Tue Aug 17, 2004 1:33 pm

Yeah, I agree that this is easy to do with a mouse. However, I am trying to emulate the BRIEF way of doing things (see http://www.lugaru.com/man/Brief.Emulation.html ). In the BRIEF editing style the user can click Ctrl-c and enter a selection mode that allows then to highlight a block of text (think column mode) without holding Shift. It is silly, but I still need to do it... Several of our developers are more comfortable and efficient using BRIEF and our new Editor will need to support these functions.

Is it true that using StartSelect requires EndSelect in the same macro? Any ideas?
User avatar
jmepatterson
Newbie
 
Posts: 4
Joined: Mon Aug 16, 2004 11:00 pm

Re: Rectangle Selection Mode

Postby mrainey56 » Tue Aug 17, 2004 1:49 pm

I don't know how you would be able to select text manually without using either the mouse or the Shift key. The best I can come up with is:


Use the assigned keystroke of your choice to initialize column mode.

Use the Shift and arrow keys to select your text

Use the assigned keystroke of your choice to run this macro:

Copy
ColumnModeOff
Key LEFT ARROW
Key RIGHT ARROW


The last two lines in the macro are a substitute for EndSelect, which has always been pretty unreliable for me.
User avatar
mrainey56
Master
Master
 
Posts: 212
Joined: Tue Jul 27, 2004 11:00 pm
Location: Spartanburg, South Carolina


Return to Macros