|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Mon Oct 17, 2005 11:35 am Post subject: Greying out "adorned" %rd |
|
|
I have been having fun and games with this (trying to grey out a %rd with spin control) and have still not come up with a completely satisfactory solution. Please see the code snippet below by way of illustration, from which three variant applets can be built by commenting out three alternative pairs of lines: those labelled either !1?, !2? or !?b (where ? denotes single character wildcard).
With !1? active, I am trying to use the ~ modifier, as documented. This greys out the edit box (although not until an attempt is made to edit), but does not disable the spin control - so I can edit a greyed out value "by proxy".
With !2? active, I am trying to use the %lc control in conjunction with the WinAPI function EnableWindow to grey out the %rd edit box. Even though the previous control is the %rd, this remains enabled, and the spin control is disabled - the reverse of what the ~ modifer achieves!
The only way I can achieve what I want to achieve, after a lot of trial and error, is with !?b active, which greys out the edit box and disables the spin control. But I don't understand why it works, and don't think it should.
Andy
program grey_doubt
use grey_day
integer iodial, tintin
gcswit = 1
tintin = 5
iodial = winio@ ('%2.2ob&')
iodial = winio@ ('A check box%cb&')
!1a iodial = winio@ ('%`rb[]%cb&', gcswit)
iodial = winio@ ('%^`rb[]%cb&', gcswit, greyme)!2b
iodial = winio@ ('A %%rd controlled by it%cb&')
iodial = winio@ ('%dd&', 1)
iodial = winio@ ('%il&', 1, 9)
!1b iodial = winio@ ('%~rd&', tintin, gcswit)
iodial = winio@ ('%rd&', tintin)!2a
iodial = winio@ ('%lc&', gchand)!2b
iodial = winio@ ('%cb')
stop
end program grey_doubt
module grey_day
integer gcswit, gchand
contains
!------------------------------------------------
integer function greyme ()
stdcall greyio 'EnableWindow' (val, val) :logical
logical greycn
greyme = 2
greycn = (gcswit .eq. 1)
if (greyio (gchand, greycn)) continue
return
end function greyme
!------------------------------------------------
end module grey_day |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Tue Oct 18, 2005 10:06 am Post subject: Greying out "adorned" %rd |
|
|
Andy
In this particular case the %lc returns the handle of the spin control rather than the edit control.
Hopefully it is the only exception to the rule and presumably occurs because Windows requires the spin to come after the edit in the Z-order.
At the moment I do not know how to overcome this ClearWin+ limitation/bug unless you want to go to the trouble of enumerating the child windows (controls) to get the handle of both the edit and the spin [by using %hw and GetWindow for example or perhaps even %lc and GetWindow(hwnd,GW_HWNDPREV)]. However, I have not tested either approach so I do not know if they will work.
|
|
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
|