|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Ralf
Joined: 30 Aug 2007 Posts: 50 Location: munich
|
Posted: Thu Jun 12, 2008 9:27 am Post subject: Bug with radio buttons? |
|
|
I have obtained a strange behaviour of radio buttons on a window left open with %lw when I open and close a second window. See the following example. When I close the second window, the radio button state of the previous window is changed:
winapp
!=============================================
Program Test_Radio_Button
!=============================================
integer :: iw, winio@
external test_window
iw = winio@ ('%`ca[Main]&')
iw = winio@ ('%^bt[Test]',test_window)
stop
end
!=============================================
integer*4 function test_window()
!=============================================
common /position/ ipos,jpos
integer :: ipos, jpos
integer :: iw, winio@
integer :: lw_handle
integer*4,dimension(3) :: irb = (/ 0,0,1 /)
test_window = 2
iw = winio@ ('%lw[owned]&', lw_handle)
iw = winio@ ('%`ca[Test]&')
iw = winio@ ('%`3ga&',irb(1),irb(2),irb(3) )
iw = winio@ ('%rb[RB1]%nl&',irb(1))
iw = winio@ ('%rb[RB2]%nl&',irb(2))
iw = winio@ ('%rb[RB3]%nl&',irb(3))
iw = winio@ ('%gp&',ipos,jpos)
iw = winio@ (' ')
call second_window
end
!=============================================
SUBROUTINE second_window
!=============================================
common /position/ ipos,jpos
integer :: ipos, jpos
integer :: iw, winio@
iw = winio@ ('%ww[no_sysmenu]&')
iw = winio@ ('%`ca[2.Window]&')
iw = winio@ ('%sp&',ipos,jpos)
iw = winio@ ('%4bt[Close]')
return
end
Best regards,
Ralf |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Thu Jun 12, 2008 12:05 pm Post subject: |
|
|
Try putting "lw_handle" and array "irb" in a common block.
Ian |
|
Back to top |
|
|
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Thu Jun 12, 2008 1:28 pm Post subject: |
|
|
Ian, I had already tried that, but the strange behaivour still occurs ! |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Jun 13, 2008 8:04 am Post subject: |
|
|
I think that something goes wrong with the ganging (%ga) in this context.
You may have to abandon %ga and write your own callback functions (one for each radio button) to handle the group radio button action. |
|
Back to top |
|
|
Ralf
Joined: 30 Aug 2007 Posts: 50 Location: munich
|
Posted: Fri Jun 13, 2008 2:35 pm Post subject: |
|
|
I have tried this, but it is still all the same |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Fri Jun 13, 2008 4:33 pm Post subject: |
|
|
I have found erratic behaviour with %ga in the past, and if it works, fine, I use it. Otherwise I do as Paul suggests and do my own "ganging" in a callback function for each radio button.
When I have had difficulty like this in the past, I also update the window.
If that doesn't work, I shout at the computer. It never works, but I do feel better afterwards. Then I make tea, take a blood pressure pill, and (when it takes effect) think of a way of doing without the radio buttons.
Bizarrely, taking %ga out and putting it back in sometimes works, but that is voodoo.
I suspect that %ga is ever so slightly and subtly broken ...
Sympathy
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Jun 13, 2008 7:41 pm Post subject: |
|
|
Ralf
If you want to post your code tha does not use %ga then I will aim to take a look at it. |
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Thu Jun 19, 2008 9:18 am Post subject: |
|
|
Remove the ganging, ie. delete the line
Quote: | iw = winio@ ('%`3ga&',irb(1),irb(2),irb(3) ) |
in the above code. |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Thu Jun 19, 2008 4:08 pm Post subject: |
|
|
I know you want "radio buttons", but if you use "check boxes" it seems to work, see below
Code: |
iw = winio@ ('%`rb[RB1]%nl&',irb(1))
iw = winio@ ('%`rb[RB2]%nl&',irb(2))
iw = winio@ ('%`rb[RB3]%nl&',irb(3))
|
This could be a grave error! (pun intended).
Radio buttons seem to toggle automatically, and this might be the error.
Regards
Ian |
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Tue Sep 02, 2008 3:46 pm Post subject: |
|
|
Any update on this? As I've repeatedly hit this bug, it would be nice to get some response. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Sep 02, 2008 4:20 pm Post subject: |
|
|
My response was that %ga does not always work and when it does not work it is necessary to provide your own callback functions to create the radio button effect. |
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Thu Sep 04, 2008 7:23 am Post subject: |
|
|
As was already posted above it is independent of the %ga, so it happens in a similar way just that the immediate effect is easier noticeable when ganging is enabled. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Thu Sep 04, 2008 10:14 am Post subject: |
|
|
I have lost my way with this topic.
Can someone post an example program (without ganging) that does not work in the expected way. |
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Thu Sep 04, 2008 10:42 am Post subject: |
|
|
The following, put into test.f95, compiled with ftn95 test.f95 /link
Code: | winapp
!=============================================
Program Test_Radio_Button
!=============================================
integer :: iw, winio@
external test_window
iw = winio@ ('%`ca[Main]&')
iw = winio@ ('%^bt[Test]',test_window)
stop
end
!=============================================
integer*4 function test_window()
!=============================================
common /position/ ipos,jpos
integer :: ipos, jpos
integer :: iw, winio@
integer :: lw_handle
integer*4,dimension(3) :: irb = (/ 0,0,1 /)
test_window = 2
iw = winio@ ('%lw[owned]&', lw_handle)
iw = winio@ ('%`ca[Test]&')
iw = winio@ ('%rb[RB1]%nl&',irb(1))
iw = winio@ ('%rb[RB2]%nl&',irb(2))
iw = winio@ ('%rb[RB3]%nl&',irb(3))
iw = winio@ ('%gp',ipos,jpos)
call second_window
end
!=============================================
subroutine second_window
!=============================================
common /position/ ipos,jpos
integer :: ipos, jpos
integer :: iw, winio@
iw = winio@ ('%ww[no_sysmenu]&')
iw = winio@ ('%`ca[2.Window]&')
iw = winio@ ('%sp&',ipos+20,jpos+20)
iw = winio@ ('%4bt[Close]')
return
end |
(it is the code posted above with the %ga removed).
Click the "Test" button, which opens two windows, one with radiobuttons, 3rd button checked, one window with a "Close" button.
Hitting the "Close" button closes its own window with the side effect of checking the 1st radiobutton.
Thanks for your help! |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Thu Sep 04, 2008 1:43 pm Post subject: |
|
|
I can now see the problem. The mouse click that closes second_window appears to act as a click on rb1.
A work-around is to put a callback on the Close button in order to correct this...
Code: | winapp
!=============================================
Program Test_Radio_Button
!=============================================
integer :: iw, winio@
integer*4,dimension(3) :: irb = (/ 0,0,1 /)
common /irb/irb,iclose
external test_window
iw = winio@ ('%`ca[Main]&')
iw = winio@ ('%^bt[Test]',test_window)
stop
end
!=============================================
integer*4 function test_window()
!=============================================
common /position/ ipos,jpos
integer :: ipos, jpos
integer :: iw, winio@
integer :: lw_handle
integer*4,dimension(3) :: irb
common /irb/irb,iclose
integer cb1,cb2,cb3
external cb1,cb2,cb3
test_window = 2
iclose = 0
irb = (/ 0,0,1 /)
iw = winio@ ('%lw[owned]&', lw_handle)
iw = winio@ ('%`ca[Test]&')
iw = winio@ ('%^rb[RB1]%nl&',irb(1),cb1)
iw = winio@ ('%^rb[RB2]%nl&',irb(2),cb2)
iw = winio@ ('%^rb[RB3]%nl&',irb(3),cb3)
iw = winio@ ('%gp',ipos,jpos)
call second_window
iclose = 0
end
integer function cb1()
integer,dimension(3) :: irb
common /irb/irb,iclose
if(irb(1) /= 0) then
if(iclose == 0) then
irb(2) = 0
irb(3) = 0
else
irb(1) = 0
endif
endif
cb1=1
end
integer function cb2()
integer,dimension(3) :: irb
common /irb/irb,iclose
if(irb(2) /= 0) then
irb(1) = 0
irb(3) = 0
endif
cb2=1
end
integer function cb3()
integer,dimension(3) :: irb
common /irb/irb,iclose
if(irb(3) /= 0) then
irb(1) = 0
irb(2) = 0
endif
cb3=1
end
!=============================================
subroutine second_window
!=============================================
common /position/ ipos,jpos
integer :: ipos, jpos
integer :: iw, winio@,cbClose
external cbClose
iw = winio@ ('%ww[no_sysmenu]&')
iw = winio@ ('%`ca[2.Window]&')
iw = winio@ ('%sp&',ipos+20,jpos+20)
iw = winio@ ('%^4bt[Close]',cbClose)
end
integer function cbClose()
integer,dimension(3) :: irb
common /irb/irb,iclose
iclose = 1
cbClose = 0
end |
|
|
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
|