Okay, so what I'm trying to do is respond to a window resize message by moving some of the buttons so they stay close to the right hand edge. They're initially located using the %ap method. Here's my trial callback just moving one button, attached to a %`mv code:
INTEGER*4 FUNCTION RESIZE_WINDOW()
INCLUDE 'FADCOM_F.INC'
INCLUDE 'FFNAMES.INC'
INCLUDE <WINDOWS.INS>
INTEGER I,TCC_DRAW_FUNC,IX,IY,IW,IH,JX,JY,JW,JH
EXTERNAL TCC_DRAW_FUNC
CALL SIZE_GRAPH_GRIDS
call get_window_location@(tcc_window,ix,iy,iw,ih)
call get_window_location@(CSHWND,Jx,Jy,Jw,Jh)
CALL MOVE_WINDOW@(CSHWND,IW-200,JY)
I = tcc_draw_func()
RESIZE_WINDOW = 2
END FUNCTION RESIZE_WINDOW
CSHWND is the handle of the button in question and tcc_window is the window it's in.
It almost works - except that JY comes back 50 larger each time it is called, with the result that my button walks rapidly off down the screen as I resize the window!
What did I miss? Do I have to take the height of the titlebar into consideration somehow? Is one of the Y values the top of the button and the other the bottom? I don't want to 'fix' it only to have it fail on different screen resolutions.
(I appreciate this is an 'if I were you I wouldn't start from here' situation but I've inherited an old, complex program and all the controls are positioned using %ap. Losing that isn't really an option.)
Thanks in advance for any suggestions,
Cath.