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.
! 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.