log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
- WROCC November 2024 talk o...ay - Andrew Rawnsley (ROD) (News:2)
- October 2024 News Summary (News:3)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
Acorn Arcade forums: Programming: Window title bars
 
  Window title bars
  Chris (16:44 17/11/2004)
  monkeyson2 (16:52 17/11/2004)
    monkeyson2 (17:43 17/11/2004)
      Chris (07:51 18/11/2004)
        jmb (08:58 18/11/2004)
          Chris (09:34 18/11/2004)
            rich (10:03 18/11/2004)
              not_ginger_matt (13:10 18/11/2004)
                rich (14:26 18/11/2004)
                  not_ginger_matt (15:33 18/11/2004)
                monkeyson2 (14:55 18/11/2004)
                  tribbles (15:13 18/11/2004)
                    not_ginger_matt (15:34 18/11/2004)
                      tribbles (15:39 18/11/2004)
                      john (01:42 19/11/2004)
                Chris (11:48 22/11/2004)
 
Chris Message #59871, posted by Chris at 16:44, 17/11/2004
Member
Posts: 283
I want to change the text in a window's titlebar before opening it. I thought the easiest way would be to use Wimp_GetWindowInfo to return the window block, then update the string pointed to at block!72. This approach works, but the call returns all the icon blocks as well as the window block, overrunning the 256-byte block I use in my WIMP library. According to the PRM, I can prevent the call returning icon data by setting bit 1 of R1 when I call the SWI, and putting the window handle in bits 2-31. However, I can't seem to do this without causing an error. Can anyone help?
  ^[ Log in to reply ]
 
Phil Mellor Message #59872, posted by monkeyson2 at 16:52, 17/11/2004, in reply to message #59871
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
My guess:

Which wimp version are you passing to Wimp_Initialise? I think you can only use the features provided by that version and earlier.

If this feature is on present in RISC OS 3.5 and above, and you are passing 310 to Wimp_Initialise, it won't work.
  ^[ Log in to reply ]
 
Phil Mellor Message #59874, posted by monkeyson2 at 17:43, 17/11/2004, in reply to message #59872
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
Actually, scrub that. I think your documentation is wrong.

I think you do need to do this:

DIM block% 256
...
block%!0 = window_handle%
SYS "Wimp_GetWindowInfo",,(block% OR 1)

[Edited by monkeyson2 at 17:45, 17/11/2004]
  ^[ Log in to reply ]
 
Chris Message #59890, posted by Chris at 07:51, 18/11/2004, in reply to message #59874
Member
Posts: 283
Thanks. I'm at the office right now at can't test this, but I'll give it a try when I get home tonight. The page in the PRM is very brief, and I may have misunderstood.

Setting titlebars does seem to be a very convoluted process (as is much about programming the RISC OS desktop, at least if you're me :( ). I discovered the other day that if you want to change the titlebar text while the window is open, you have to issue a Wimp_ForceRedraw call. Is this right? If so, bonkers.
  ^[ Log in to reply ]
 
JMB Message #59891, posted by jmb at 08:58, 18/11/2004, in reply to message #59890
Member
Posts: 467
Setting titlebars does seem to be a very convoluted process (as is much about programming the RISC OS desktop, at least if you're me :( ). I discovered the other day that if you want to change the titlebar text while the window is open, you have to issue a Wimp_ForceRedraw call. Is this right? If so, bonkers.
Not at all bonkers, you're updating a section of the screen (ie forcing a redraw...).

The simplest way to do it is ensure wimp 380 (ie the nested window manager) in your wimp_initialise call and do:

SYS"Wimp_ForceRedraw",window_handle%,&4b534154,3

which updates only the titlebar.

Of course, if you really want something like set_titlebar_text(window, "My new title";); then you should really be using a sensible library (if you're using C) or just write a PROC to do it if you're using BASIC (there's probably usable BASIC libraries too but I wouldn't know).
  ^[ Log in to reply ]
 
Chris Message #59893, posted by Chris at 09:34, 18/11/2004, in reply to message #59891
Member
Posts: 283
Not at all bonkers, you're updating a section of the screen (ie forcing a redraw...).
The simplest way to do it is ensure wimp 380 (ie the nested window manager) in your wimp_initialise call and do:
SYS"Wimp_ForceRedraw",window_handle%,&4b534154,3
which updates only the titlebar.
Well, perhaps not bonkers. I suppose I assumed that the titlebar would be updatable more or less in the same way as an ordinary indirected text icon. Thanks for the info on the nested wimp version, though.

Of course, if you really want something like set_titlebar_text(window, "My new title";); then you should really be using a sensible library (if you're using C) or just write a PROC to do it if you're using BASIC (there's probably usable BASIC libraries too but I wouldn't know).
That's what I'm trying to do (write a suitable PROC, that is) :) . Most of the time, I find adding to my BASIC Wimp library bit by bit as the need arises fairly straightforward; now and again I get stuck.
  ^[ Log in to reply ]
 
Richard Goodwin Message #59894, posted by rich at 10:03, 18/11/2004, in reply to message #59893
Rich
Dictator for life
Posts: 6828
PROCchangewindowtitle(savehandle%,"Save Palette")

DEF PROCchangewindowtitle(handle%,title$)
block%!0 = handle%
SYS "Wimp_GetWindowInfo",,block%
$(!(block%+76))=title$
SYS "Wimp_ForceRedraw",-1,block%!4,(block%!16)-36,block%!12,block%!16+36
ENDPROC
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Richard Wilson Message #59897, posted by not_ginger_matt at 13:10, 18/11/2004, in reply to message #59894
Member
Posts: 63
PROCchangewindowtitle(savehandle%,"Save Palette";)

DEF PROCchangewindowtitle(handle%,title$)
block%!0 = handle%
SYS "Wimp_GetWindowInfo",,block%
$(!(block%+76))=title$
SYS "Wimp_ForceRedraw",-1,block%!4,(block%!16)-36,block%!12,block%!16+36
ENDPROC
You've forgot to DIM block% and forgot to set bit 0 of R1 to only get the window data (you'll quite possibly overflow your buffer if you don't) ;-).
In my opinion everyone really should be using the nested wimp to redraw the title bar (it's been around for many many years now and works from 3.1 upwards) as it stops non-standard window furniture breaking things and is also just a lot 'cleaner'.
Off the top of my head the minor changes would give:

DEF PROCchangewindowtitle(handle%,title$)
DIM block% 256
block%!0 = handle%
SYS "Wimp_GetWindowInfo",,(block% OR 1)
$(!(block%+76))=title$
SYS "Wimp_ForceRedraw", handle%,&4b534154,3
ENDPROC

This still doesn't check if you're overflowing the title dta buffer, and doesn't check the flags to ensure that it's an indirected title, but will probably work.

[Edited by not_ginger_matt at 13:10, 18/11/2004]
  ^[ Log in to reply ]
 
Richard Goodwin Message #59900, posted by rich at 14:26, 18/11/2004, in reply to message #59897
Rich
Dictator for life
Posts: 6828
PROCchangewindowtitle(savehandle%,"Save Palette";)

DEF PROCchangewindowtitle(handle%,title$)
block%!0 = handle%
SYS "Wimp_GetWindowInfo",,block%
$(!(block%+76))=title$
SYS "Wimp_ForceRedraw",-1,block%!4,(block%!16)-36,block%!12,block%!16+36
ENDPROC
You've forgot to DIM block%
Obviously not. I don't load the windows or open them in the code snippet either. I thought it was quite obvious that it was an excercise for the reader to write the rest of the program rather than wait for me to do it allfor them.

In my opinion everyone really should be using the nested wimp to redraw the title bar (it's been around for many many years now and works from 3.1 upwards)
In my opinion, my 4MB A310 is struggling with memory requirements in the first place thanks. Loading a nested WIMP for a machine that'll never use it is silly.
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Phil Mellor Message #59903, posted by monkeyson2 at 14:55, 18/11/2004, in reply to message #59897
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
SYS "Wimp_ForceRedraw",-1,block%!4,(block%!16)-36,block%!12,block%!16+36

Oooh, ooh, I can be petty too! You're making assumptions about the height of the toolsprites. :P
  ^[ Log in to reply ]
 
Jason Tribbeck Message #59904, posted by tribbles at 15:13, 18/11/2004, in reply to message #59903
tribbles
Captain Helix

Posts: 929
From memory, I use Wimp_GetWindowOutline and subtract the height from Wimp_GetWindowState...

[Edited by tribbles at 15:13, 18/11/2004]
  ^[ Log in to reply ]
 
Richard Wilson Message #59905, posted by not_ginger_matt at 15:33, 18/11/2004, in reply to message #59900
Member
Posts: 63
You've forgot to DIM block%
Obviously not. I don't load the windows or open them in the code snippet either.
I'm very confused. Why would you need to load or open the window? You're passing a window handle to a routine called 'changewindowtitle' which, unless my concept of the english language has suddenly eluded me, should surely just change the window title?
I thought it was quite obvious that it was an excercise for the reader to write the rest of the program rather than wait for me to do it all for them.
But it clearly isn't an exercise for the reader to bug-fix the routine? Your tone appears to suggest I've offended you, which was certainly not my intent - I was simply pointing out how you could go from what you posted to a routine that is nice and generic.
In my opinion everyone really should be using the nested wimp to redraw the title bar (it's been around for many many years now and works from 3.1 upwards)
In my opinion, my 4MB A310 is struggling with memory requirements in the first place thanks. Loading a nested WIMP for a machine that'll never use it is silly.
s/with memory requirements// ;-)
Setting the minimum specifications for a program as a machine that is now 17 years old and hasn't had a freely available software upgrade is not just silly, it's perverse.
  ^[ Log in to reply ]
 
Richard Wilson Message #59906, posted by not_ginger_matt at 15:34, 18/11/2004, in reply to message #59904
Member
Posts: 63
From memory, I use Wimp_GetWindowOutline and subtract the height from Wimp_GetWindowState...
Doesn't that have a side effect of redrawing whatever's in front of the window title if it's not at the top of the stack though?
  ^[ Log in to reply ]
 
Jason Tribbeck Message #59907, posted by tribbles at 15:39, 18/11/2004, in reply to message #59906
tribbles
Captain Helix

Posts: 929
Doesn't that have a side effect of redrawing whatever's in front of the window title if it's not at the top of the stack though?
Yes, it does.

However, it was in answer to:

You're making assumptions about the height of the toolsprites
I was suggesting a way to get the height of the toolsprites (while giving you coordinates to redraw).

Rich's version also redraws what's on top...
  ^[ Log in to reply ]
 
John D Message #59919, posted by john at 01:42, 19/11/2004, in reply to message #59906
Member
Posts: 261

Doesn't that have a side effect of redrawing whatever's in front of the window title if it's not at the top of the stack though?
Yeah POPStar does that for its main text icons and it's quite annoying sometimes, but it's a very solid program apart from that!
  ^[ Log in to reply ]
 
Chris Message #60020, posted by Chris at 11:48, 22/11/2004, in reply to message #59897
Member
Posts: 283
Thanks to all for the help: working fine now :) .
  ^[ Log in to reply ]
 

Acorn Arcade forums: Programming: Window title bars