|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
mhudson
Joined: 05 Jan 2006 Posts: 18
|
Posted: Thu May 18, 2006 3:08 am Post subject: Problem with callback attached to a spin wheel |
|
|
I've been having a bit of trouble with the following code:
|
|
Back to top |
|
|
Anonymous Guest
|
Posted: Thu May 18, 2006 3:13 am Post subject: Problem with callback attached to a spin wheel |
|
|
Okay, so clicking the "code" button caused the message to be posted prematurely. Trying again.
The code is as follows:
<code>
program spinwheeltest
implicit none
include <clearwin.ins>,nolist
integer :: i,index,NumSites,Zone
common /blk/ index,Zone
integer :: UpdateCallback
external UpdateCallback
NumSites=4
index=0
Zone=0
i = winio@('%cnSite number: %il%dd%`^3rd%`il%2nl&',
1 1,NumSites,1,index,UpdateCallback)
i = winio@('Zone:%`3rd',Zone)
end program spinwheeltest
integer function UpdateCallback()
implicit none
include <clearwin.ins>,nolist
integer :: index,Zone
common /blk/ index,Zone
Zone=Zone+1
call window_update@(Zone)
UpdateCallback=2
end function UpdateCallback
</code>
The aim is to create a window with a spin wheel and a variable that is updated as the spin wheel is changed. In this case the Zone variable just gets incremented each time the spin wheel is used either up or down.
The %rd boxes need to be read-only so that the user can only update the values by using the spin wheel.
I find that, when the %rd attached to the %dd is made read-only, the call back function is not called when the spin wheel is used, and so the Zone variable does not get updated. The callback does get called if the spin-wheel is attached to a non-read-only box.
I am using 4.91 of FTN95 on Windows XP.
Any ideas? :confused:
Mark. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Thu May 18, 2006 9:42 am Post subject: Problem with callback attached to a spin wheel |
|
|
Mark
This looks like a bug in ClearWin+.
We can probably fix it for the next release but in the meantime it works quite well if the spin edit box is not read-only. Any number that you type in is adjusted to be in range and sometimes it is quicker to type in a value.
I cannot think of a simple work-around at the moment. |
|
Back to top |
|
|
Anonymous Guest
|
Posted: Thu May 18, 2006 9:49 am Post subject: Problem with callback attached to a spin wheel |
|
|
Hi Paul,
Thanks for your reply. It turns out that %rs does trigger the callback, so what I've done is this:
Use %`rs instead of %`rd, convert my integer to be changed into a string using CNUM, and then check on the callback_reason with clearwin_string@ in the callback function triggered by the spin wheel to check for SPIN_UP and SPIN_DOWN, and change the integer (and string) manually according to the direction clicked. This has worked fine.
Mark. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri May 19, 2006 9:57 am Post subject: Problem with callback attached to a spin wheel |
|
|
Mark
This bug has been fixed for the next release. |
|
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
|