|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Sun Nov 19, 2006 5:12 am Post subject: Updating the colour of a coloured bar |
|
|
I have a number of object (MAX) of which the current one is numbered (KUR).
Typically, MAX is 3 or 4, and never more than 50.
Each object has a different colour with IRED, IGRN and IBLU components.
I thought it might be useful to show the colour of the current object as
the list was stepped through using a %dd spin control. Here's a fragment
of the code. ICOL is set in a separate statement so as to avoid
continuations.
DP=1.0D0
IA=WINIO@('Object No %il%dd&',1,MAX,1)
IA=WINIO@('%3`rd%`il&',KUR)
ICOL=RGB@(IRED(KUR),IGRN(KUR),IBLU(KUR))
IA=WINIO@('%nl%cn%10br&',DP,ICOL)
I can't seem to get my head round where I call window_update@, and with
which parameter, KUR, or ICOL (or DP for that matter, but as I want the bar
filled, DP always needs to end up as 1.0D0, and it isn't a convenient
entity to alter). I've tried most places in the code! The problem I find is
that I can't get the colour of the bar to change, unless I close the window
and reopen it, whereupon it is changed. I'd like it to change as I stepped
through the list of objects.
I've also tried changing button colours and backgrounds etc to get the
colour coding, but I'm missing something in my understanding.
Any suggestions would be gratefully received.
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Mon Nov 20, 2006 1:42 am Post subject: Updating the colour of a coloured bar |
|
|
Eddie
There is currently no way to change the %br colour dynamically. You can only set the colour when the window is created.
If you really want this effect we could add the feature to ClearWin+ but we would charge you for this service or with clever programming you can open a new window with the colour change without the user being aware of this. i.e. you create a copy of the window on top of the old one and then delete the old window. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Mon Nov 20, 2006 1:59 am Post subject: Updating the colour of a coloured bar |
|
|
Hi Paul,
The copy & delete is a good idea - thanks - although I may just ditch my original concept, and find a different way of indicating which object is currently selected. It's something of a "labour of love", and not of any commercial value. Your reply was helpful, because it stops me barking up the wrong tree. I'm always puzzled about what is updated when.
I don't always find the online help useful when it comes to the finer points, such as this, although it is great for getting started.
I noted the time of your reply, and hope that you are working in a different time zone from me!
Regards
Eddie
|
|
Back to top |
|
|
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Mon Nov 20, 2006 5:37 am Post subject: Updating the colour of a coloured bar |
|
|
Eddie,
Have you considered using a graphics region (%gr) inplace of %br, as with the appropriate callback you could easily update the graphics with a different colour fill.
Regards,
John _________________ John Horspool
Roshaz Software Ltd.
Gloucestershire |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Mon Nov 20, 2006 3:45 pm Post subject: Updating the colour of a coloured bar |
|
|
Hi John,
I had considered it, but hadn't tried it. I had tried callbacks with %br, but as Paul said, the colour can't be "watched for" as it is set once, and only once, when the window opens. I am still a bit confused about what updates when, and wasn't sure whether it was something I was doing wrong (in which case the graphics region wouldn't work either).
When I get a moment, I'll try it.
You caught me being lazy, again!
Eddie
|
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Tue Nov 21, 2006 1:56 am Post subject: Updating the colour of a coloured bar |
|
|
John Horspool's suggestion worked, very nicely. It was necessary to fill the %gr both on startup, and each time the object selector is altered (through the callback). I found that check_on_focus_loss inhibited the update, presumably because focus was never lost. Obvious in retrospect.
I had chosen that my objects were arranged on the screen with No. 1 at the top, and No. "n" at the bottom, and that I needed to put the %dd parameter to -1 so that when the "up" spin control was selected, the object number was decremented. This apparently bizarre choice makes the selector work intuitively, so that spinning "up" or "down" goes through the objects as laid out on the screen - their "object number" is actually immaterial.
Thanks to John & Paul for help.
Eddie |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|