|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Fri Mar 06, 2015 9:39 am Post subject: Dynamic color highlighting of controls |
|
|
I tried to use dynamic highlighting of different controls (it's very good reminder/warning/help) but succeeded only with radiobuttons. Here is text example with GUI and callback which changes colors. Click on radiobutton and see that it works OK. But changing number to 10 should change its background color but it does not. Buttons also do not change colors. Am i wrong with something?
Code: | use clrwin
common lcRb, krb, lcButton, Number, lcNumber
integer, external :: cbChng
krb = 0
Number = 9
i=winio@('%ww&')
i=winio@('Highlight rb %ta%^rb[HighLight me]%lc%ff&', krb, cbChng, lcRb)
i=winio@('Highlight if >10 %ta%dd%6^rd%lc%ff&',1, Number, cbChng, lcNumber)
i=winio@('%cn%^bt[Highlight Button]%lc %bt[Exit]&', cbChng, lcButton)
i=winio@('%ac[esc]','exit')
end
integer function cbChng()
use clrwin
common lcRb, krb, lcButton, Number, lcNumber
if(krb.eq.0) icolRb = RGB@(255,255,255)
if(krb.eq.1) icolRb = RGB@(255,190,255)
call set_control_back_colour@(lcRb, icolRb)
if(Number.lt.10) icolNumber = RGB@(255,255,255)
if(Number.ge.10) icolNumber = RGB@(255,190,255)
call set_control_back_colour@(lcNumber,icolNumber)
call set_control_back_colour@(lcButton,icolRb)
cbChng=2
end function |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Fri Mar 06, 2015 2:21 pm Post subject: |
|
|
set_control_back_colour@ does not work for %bt which has its own mechanism...
Code: | winapp
integer RGB@,winio@
integer bcol,green
common bcol,green
integer,external::cb
green = 255
bcol = RGB@(255,green,255)
i = winio@("%`bc&", bcol)
i = winio@("%^bt[Change]", cb)
end
integer function cb()
integer bcol,green
common bcol,green
integer RGB@
green = 255 - green
bcol = RGB@(255,green,255)
cb = 1
end
|
|
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Fri Mar 06, 2015 10:47 pm Post subject: |
|
|
Thanks, i knew this way of coloring for buttons, but did not know that it updatable. Also i supposed that set_control_back_colour@ changes colors of any control as its name says. Will it do that for all controls in the future?
And how about %rd/%rf |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Sat Mar 07, 2015 8:17 am Post subject: |
|
|
Dan
Some questions are best answered by trial and error.
set_control_back_colour@ does not work for %bt and that will not change because %bt is a native ClearWin+ button that has its own paint. Other native ClearWin+ controls may have a similar limitation.
My guess is that %rd and %rf will respond to set_control_back_colour@ (the documentation may have something to say on this).
If you find a control does not respond and you need it to, then please let me know and I will see what can be done. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Sat Mar 07, 2015 12:42 pm Post subject: |
|
|
Paul,
Yes, the example above exactly demonstrates that background color of %rd is not changing while documentation as i understand it says it should. Do you see different behavior? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Sat Mar 07, 2015 4:27 pm Post subject: |
|
|
Seems to work OK...
Code: | winapp
integer i,num,hwnd,winio@
integer,external::cb
common hwnd
num = 0
i = winio@("%rd&", num)
i = winio@("%lc&", hwnd)
i = winio@("%nl%cn%^bt[Change]", cb)
end
integer function cb()
include <windows.ins>
logical grey
integer hwnd,colour
common hwnd
save grey
data grey/.FALSE./
if(grey)then
colour = RGB@(255,255,255)
else
colour = RGB@(180,180,180)
endif
grey = .NOT.grey
call set_control_back_colour@(hwnd, colour)
cb = 2
end
|
|
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2819 Location: South Pole, Antarctica
|
Posted: Sun Mar 08, 2015 1:12 am Post subject: |
|
|
Thanks, Paul. Took me an hour to find where the problem is even knowing after your post that somehow it should work. And the reason is in %lc or %dd. If i change one your line to
Code: | i = winio@("%dd%rd&", 1, num) |
adding just %dd it stops working |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Sun Mar 08, 2015 8:21 am Post subject: |
|
|
OK. I will fix that so that it will work with the next release. |
|
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
|