[I7] Positioning text in non-status-line text grid windows

Using Flexible Windows to provide a second Glulx text grid window at the bottom of the screen. I’d like to use glk_window_move_cursor to move the cursor to “tab stops” in this bottom window, can’t figure out how. Initially I tried looking up the window name in the I6 code, and then trying this:

To tab to row (Y - a number) column (X - a number):
	(-  glk_window_move_cursor(**I6 bottom window name**, {X}, {Y}); -).

To do the thing:
	tab to row 1 column 27;

but it looks like I7 renames the bottom window every time it compiles, so when I run the game it crashes with the error “Reference to nonexistent Glk object”.

I get this same error if I try:

To tab to row (Y - a number) column (X - a number):
	(-  glk_window_move_cursor((+ main window +), {X}, {Y}); -).

To do the thing:
	tab to row 1 column 27;

and also

To tab to row (Y - a number) column (X - a number) in (W - a text grid g-window):
	(-  glk_window_move_cursor({W}, {X}, {Y}); -).

To do the thing:
	tab to row 1 column 27 in the bottom window;

Can anyone help out? Thanks.

1 Like

So the issue is that you’re calling it with the Inform 7 object, not the Glk reference ID. Change the final example to this and it should work:

To tab to row (Y - a number) column (X - a number) in (W - a text grid g-window):
	(-  glk_window_move_cursor({W}.(+ ref number +), {X}, {Y}); -).

This should really be a built-in part of Flexible Windows, I’m not sure why I never added it. I’ll add it soon.

1 Like

Actually the row/column are zero-based, so if you want to use row 1 column 1 in your source text (which is most natural for people) then you need this instead (funnily enough it’s already in the source of that layout error demo):

To set the cursor position in (w - text grid g-window) to row (y - number) column (x - number):
	(- glk_window_move_cursor({w}.(+ ref number +), {x}-1, {y}-1); -).
2 Likes

Does the trick, thanks!