Hello,
I have a photon program that I save the x & y position of the window along
with the window extents to an ini file. Then when I startup I try and set
these settings but the window jumps to the saved x & y position and then
back to the 0,0 position.
I have turned off the auto-generated command line arguments in the startup
information window but this makes no difference. I’ve tried putting my
initialisation code as a Setup Function both in the pre-realize and
post-realize call backs, also in the window open and realized call backs
with no luck.
Here’s my call back code :-
PhWindowEvent_t we;
we.event_f = Ph_WM_MOVE;
we.rid = PtWidgetRid(ABW_base);
we.pos.x = setup.x;
we.pos.y = setup.y;
PtForwardWindowTaskEvent(PhGetConnectionid(), &we);
The above code works fine when I call it from my setup dialog but not in any
initialisation routines, I assume I’m calling it to early or something of
that nature ?
The resize and move flags are set for the window. I also have the problem
when I try and use the code below to resize the window I lose the window
frame and the size looks wrong.
PhWindowEvent_t we;
we.event_f = Ph_WM_RESIZE;
we.rid = PtWidgetRid(ABW_base);
we.size.w = setup.w;
we.size.h = setup.h;
PtForwardWindowTaskEvent(PhGetConnectionid(), &we);
I use PtWidgetExtent(ABW_base, &ext) to get the initial values for the width
and height, they tend to agree with the Phab W & H values (although they are
out by 1?).
I use PtGetAbsPosition(ABW_base, &x, &y) to get the absolute window
position, this again works but is out by the window frame size which is 5 in
the x and 21 in the y, will this offset always be consistent ?
Any suggestions or better function calls to do these operations would be
great.
TIA, Brett.