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 

Missing something here

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1214
Location: Morrison, CO, USA

PostPosted: Tue Dec 05, 2017 1:12 am    Post subject: Missing something here Reply with quote

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
View user's profile Send private message Visit poster's website
DanRRight



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

PostPosted: Tue Dec 05, 2017 5:52 am    Post subject: Reply with quote

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



Joined: 13 Oct 2014
Posts: 1214
Location: Morrison, CO, USA

PostPosted: Tue Dec 05, 2017 6:27 am    Post subject: Reply with quote

Thanks, Dan. Works great.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Dec 05, 2017 8:53 am    Post subject: Reply with quote

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



Joined: 13 Oct 2014
Posts: 1214
Location: Morrison, CO, USA

PostPosted: Tue Dec 05, 2017 4:01 pm    Post subject: Reply with quote

Thanks, Paul. Good to know.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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