forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dynamic color highlighting of controls

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Mar 06, 2015 9:39 am    Post subject: Dynamic color highlighting of controls Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Mar 06, 2015 2:21 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Mar 06, 2015 10:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Mar 07, 2015 8:17 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sat Mar 07, 2015 12:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Mar 07, 2015 4:27 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Mar 08, 2015 1:12 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sun Mar 08, 2015 8:21 am    Post subject: Reply with quote

OK. I will fix that so that it will work with the next release.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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