SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: Mr68360 on April 04, 2007, 10:00:34 pm

Title: Function to get current column/line?
Post by: Mr68360 on April 04, 2007, 10:00:34 pm
Sorry for the basic question.

I just want the current column and line the cursor is on.

Tried this:

_command foo()
{
   _str s1 = "column is " :+ _p_col;
   say(s1);
   _str s2 = "line is " :+ _p_row;
   say(s2);
}

but compiler reports _p_col is not initialized (I suspect the property _p_col belongs to an Editor Control whose instance the macro cannot see).

What are the position functions??

Thanks,
Chuck
Title: Re: Function to get current column/line?
Post by: Graeme on April 05, 2007, 12:38:22 am
I just want the current column and line the cursor is on.

Tried this:

_command foo()
{
   _str s1 = "column is " :+ _p_col;
   say(s1);
   _str s2 = "line is " :+ _p_row;
   say(s2);
}

but compiler reports _p_col is not initialized (I suspect the property _p_col belongs to an Editor Control whose instance the macro cannot see).

_command foo()
{
   if (_no_child_windows()) {
    say('no child windows');
    return;
   }
   _str s1 = "column is " :+ _mdi.p_child.p_col;
   say(s1);
   _str s2 = "line is " :+ _mdi.p_child.p_line;
   say(s2);
}

If the editor control is not an mdi child then you need to get its window ID and use window_id.p_col

Graeme