|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Tue Dec 05, 2017 1:12 am Post subject: Missing something here |
|
|
I'm trying set the text and background colours of a button control. From the documentation, the following code "should" work, but doesn't. It switches both the background and text colours back and forth.
Code: |
! winapp
use mswin
integer,external:: button6
integer button_handle
common/lc/button_handle
i = winio@('%^bt[Ignore Data]&',button6)
i = winio@("%lc",button_handle)
END
integer function button6()
use mswin
integer:: toggle=0
integer button_handle
common/lc/button_handle
button6 = 1
if(toggle.eq.0) then
call set_control_text_colour@(button_handle,rgb@(255,0,0))
call set_control_back_colour@(button_handle,rgb@(255,255,0))
else
call set_control_text_colour@(button_handle,rgb@(0,255,255))
call set_control_back_colour@(button_handle,rgb@(0,0,255))
endif
toggle = mod(toggle+1,2)
print *,toggle
return
end
|
Obviously, I'm missing something. Setting the background color with a variable, then updating the variable to change the background works, but there's no equivalent for the text colour from what I see in the documentation. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2821 Location: South Pole, Antarctica
|
Posted: Tue Dec 05, 2017 5:52 am Post subject: |
|
|
Paul or others may find why it does not work but a bit different method works fine
Code: | use mswin
integer,external:: button6
common/lc/ibt_textColor, ibt_bkgColor
ibt_textColor=rgb@(255,255,255)
ibt_bkgColor=rgb@(255,0,0)
i=winio@('%`bc%`bu%^bt[Ignore Data]%es', ibt_bkgColor, ibt_textColor, button6)
END
!...................................
integer function button6()
use mswin
integer:: toggle=0
common/lc/ibt_textColor, ibt_bkgColor
save toggle
if(toggle.eq.0) then
ibt_textColor=rgb@(0,0,0)
ibt_bkgColor =rgb@(222,222,0)
else
ibt_textColor=rgb@(255,255,255)
ibt_bkgColor =rgb@(255,0,0)
endif
call window_update@(ibt_textColor)
call window_update@(ibt_bkgColor)
toggle = mod(toggle+1,2)
print *,toggle
button6 = 2
end
|
|
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Tue Dec 05, 2017 6:27 am Post subject: |
|
|
Thanks, Dan. Works great. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7929 Location: Salford, UK
|
Posted: Tue Dec 05, 2017 8:53 am Post subject: |
|
|
set_control_text_colour@ and set_control_back_colour@ work for %rd etc. but apparently not for %bt (even when combined with %bc). |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1217 Location: Morrison, CO, USA
|
Posted: Tue Dec 05, 2017 4:01 pm Post subject: |
|
|
Thanks, Paul. Good to know. |
|
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
|