When a Wimp_Poll returns reason code 1 (RedrawWindow), then Wimp_RedrawWindow must be the first Wimp call made, and it should
not be called at any other time.
Ah, now I understand what you mean - and I sin against that rule
indeed. Before calling Wimp_RedrawWindow, I do a Wimp_GetWindowInfo
call. Should I really move that one after the redraw call?
What details do you need to find from Wimp_GetWindowInfo to perform the redraw, that you don't get in the block returned by Wimp_RedrawWindow and Wimp_GetRectangle?
If I do, things go horribly wrong.
Define "horribly wrong"... which might help us help you. :-)
You should probably be calling
SYS "Wimp_GetWindowInfo",,block% OR 1
unless you know that you have space for all of the icon definitions in
block%
The details that I get from Wimp_GetWindowInfo is the x and y origins of
the window in question:
SYS "Wimp_GetWindowInfo",,block%
ox% = block%!4 - block%!20
oy% = block%!16 - block%!24
Following Martin A.'s suggestion, I now have:
DEF PROCredraw(wh%)
!block% = wh%
SYS "Wimp_RedrawWindow",,block% TO more%
WHILE more%
ox% = block%!4 - block%!20
oy% = block%!16 - block%!24
etc...
There's no noticeable difference in behaviour between the two
versions, although I would think that the first one might be a
microscopic bit faster, since it has to calculate the ox% and oy%
only once.
The window in question doesn't have any icons at all, but the point was
that I shouldn't call Wimp_GetWindowInfo in the first place. At least, not before calling Wimp_RedrawWindow.
So, actually my question is: how compulsory is the alledged rule that no other call should precede the Wimp_RedrawWindow call?
When a Wimp_Poll returns reason code 1 (RedrawWindow), then Wimp_RedrawWindow must be the first Wimp call made, and it should not
be called at any other time.
Does that help?
I think what Martin Avison was saying in message <59d9b91b68News03@avisoft.f9.co.uk> was that Wimp_RedrawWindow should
not be called by your program *at all* save in response to a Wimp_Poll
redraw window request (reason code 1):
Looking through the StrongHelp manuals (I've never done any window
updating outside the poll loop), I think you may be intended to call Wimp_ForceRedraw (which will cause your window to receive the above
mentioned Wimp_Poll request) or Wimp_UpdateWindow, which does the same
thing, only not via the poll loop but immediately.
DEF PROCredraw(wh%)
!block% = wh%
SYS "Wimp_RedrawWindow",,block% TO more%
WHILE more%
ox% = block%!4 - block%!20
oy% = block%!16 - block%!24
etc...
If that is a concern, how about moving the ox% & oy% calculations from
within the WHILE to just before it? I do not think that the visible
area will change between redraws - although obviously the redraw
rectangle will.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 212:56:07 |
Calls: | 6,619 |
Calls today: | 1 |
Files: | 12,168 |
Messages: | 5,317,382 |