Author Topic: Function to get current column/line?  (Read 2862 times)

Mr68360

  • Community Member
  • Posts: 44
  • Hero Points: 2
Function to get current column/line?
« 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

Graeme

  • Senior Community Member
  • Posts: 2062
  • Hero Points: 248
Re: Function to get current column/line?
« Reply #1 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