rhh88@ecs.soton.ac.uk (Heywood RH) (01/30/91)
I have a problem. I need to change the title of a window at quite regular periods but whatever I seem to do the title remains unchanged. I have tried changing the indirected pointer to the title to a new message and then reopening the window but it does not seem to work. I have do a tempary bodge job of the problem so I can get the rest of the program done that involves creating a new window with the correct title, opening that and deleteing the old window (YUUUKKKKKKKK!!!!!) Someone sort this out because I can not imagine that it is at all difficult! Thanks Rik ______________________________________________________ / \ / Richard Heywood (Rik) \ / rhh88@uk.ac.soton.ecs \ \ / \ The Spice must flow / \______________________________________________________/ Glib's Fourth Law of Unreliability: Investment in reliability will increase until it exceeds the probable cost of errors, or until someone insists on getting some useful work done.
pcolmer@acorn.co.uk (Philip Colmer) (01/31/91)
In article <6482@ecs.soton.ac.uk> rhh88@ecs.soton.ac.uk (Heywood RH) writes: >... I have tried changing the indirected pointer to the title to a new >message and then reopening the window but it does not seem to work. I think you have to close the window before reopening it. This is basically to force the window manager to realise that the window needs to be redraw. Simply reopening the window with it already on the screen won't do it. I use this technique and it does work. --Philip ------------------------------------------------------------------------------ Hi, I'm Pisces. I just dive right in ...
colin@gouldnl.encore.nl (Colin Smale) (01/31/91)
In <6482@ecs.soton.ac.uk> rhh88@ecs.soton.ac.uk (Heywood RH) writes: >I have a problem. I need to change the title of a window at quite >regular periods but whatever I seem to do the title remains unchanged. >I have tried changing the indirected pointer to the title to a new >message and then reopening the window but it does not seem to work. > I have do a tempary bodge job of the problem so I can get the rest of >the program done that involves creating a new window with the correct >title, opening that and deleteing the old window (YUUUKKKKKKKK!!!!!) The neatest way of doing it is to force a redraw of the title bar. This can be accomplished by using Wimp_GetWindowOutline (???) to get the overall outline of the window (including title bar etc), Wimp_GetWindowState to get the visible work area coordinates and calling Wimp_ForceRedraw with physical screen coordinates (window handle=-1) using the x-coordinates from either call above, ymin=top of visible work area and ymax=top of window outline. Alternatively you can cheat a bit by knowing that the title bar is always a constant height (64?). This works at least for the case of changing the CONTENTS of the window title buffer; you are actually changing the buffer address itself. Try allocating a static buffer for the title and copying into it.
RMokady@acorn.co.uk (Ran Mokady) (01/31/91)
In article <4860@acorn.co.uk> pcolmer@acorn.co.uk (Philip Colmer) writes: >In article <6482@ecs.soton.ac.uk> rhh88@ecs.soton.ac.uk (Heywood RH) writes: > >>... I have tried changing the indirected pointer to the title to a new >>message and then reopening the window but it does not seem to work. > >I think you have to close the window before reopening it. This is basically >to force the window manager to realise that the window needs to be redraw. >Simply reopening the window with it already on the screen won't do it. I use >this technique and it does work. The way Philip describes works, but is not the correct way to do it as it may have some undesirable effects in future versions of Risc OS. The correct way to do it is: Change the title string. Call Wimp_GetWindowOutline , this gives you Window outline x0 (wox0) Window outline x1 (wox1) Window outline y1 (woy1) Call Wimp_GetWindowState , this gives you Work area y1 (way1) Call Wimp_ForceRedraw with: R0 = -1 ; Redraw screen area. R1 = wox0 R2 = way1 R3 = wox1 R4 = woy1 This may invalidate some other areas on the screen if your window is not at the front, but since in most cases when the title changes your window is probably at the front, this is not to bad and it is guaranteed to work correctly in the future. Ran. -------------------------------------------------------------- "We're children, Needing other children And yet letting our grown up pride Hide all the need inside Acting more like children than children"