View previous topic :: View next topic |
Author |
Message |
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Thu Jul 14, 2011 7:56 am Post subject: Listview+Button hangs |
|
|
The following application hangs when you click into one of the cells (starting the cell edit mode) and then directly click on the Cancel button. There is no reaction to this button click, debugging this turns out that the callback of the listview is called (end edit) but rather than the callback of the Cancel button the listview callback is executed again (with begin edit mode).
This was reported for a Win7 system, verified on an XP 32bit installation, the test application was reduced out of a larger application on Win7/64bit.
Code: | winapp
program listbox
implicit none
integer, dimension(15) :: selection
character (len=18), dimension(16) ::lvdata
integer :: view, i
external cancel, callback
selection = 0
view = 1
lvdata(1) = '|Head1|Head2|Head3'
do i=2,16
lvdata(i) = '|DataX|DataY|DataZ'
enddo
i = winio@ ('%^lv[edit_cells]&', 380,100, lvdata, 16, selection, view, callback)
i = winio@ ('%ff%nl%cn%^8bt[Cancel]', cancel)
end program listbox
integer function cancel()
implicit none
cancel=0
end function cancel
integer function callback()
implicit none
callback = 2
end function callback |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Thu Jul 14, 2011 12:28 pm Post subject: |
|
|
You need
Code: | integer cancel, callback
|
in your program. |
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Thu Jul 14, 2011 3:52 pm Post subject: |
|
|
Doesn't change a single bit regarding the hangup (==still doesn't call the cancel routine if the cell was being edited). |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Thu Jul 14, 2011 5:02 pm Post subject: |
|
|
Paul,
Although the callback functions must be INTEGER*4, FTN95 works fine with the function names being defined only as EXTERNAL. I've often puzzled over this.
Eddie
Last edited by LitusSaxonicum on Thu Jul 14, 2011 8:16 pm; edited 1 time in total |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Thu Jul 14, 2011 6:45 pm Post subject: |
|
|
I assumed that "hangs" meant an abnormal failure like an exception being raised or an unexpected termination.
If you are editing a cell then you could use a click somewhere else to end the edit. If you click over the Cancel button then you may need two clicks, one to end the edit and one to get the effect of the Cancel callback which is to close down the application (because of the zero return value).
If a callback function has the wrong return type then it may work but my guess is that the result will be unsafe. |
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Fri Jul 15, 2011 7:22 am Post subject: |
|
|
Quote: | If you click over the Cancel button then you may need two clicks |
That would be pretty bad but even that does NOT work.
Quote: | If a callback function has the wrong return type then it may work but my guess is that the result will be unsafe. |
The test example was stripped down as far as possible and the declaration you're pointing at was not required. But as noted for the reproducability of this bug it behaves the same with the declaration. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Fri Jul 15, 2011 9:47 am Post subject: |
|
|
OK. I can see the problem now and will aim to fix it. |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2593 Location: Sydney
|
Posted: Fri Jul 15, 2011 9:51 am Post subject: |
|
|
I tried your example and then modified it to give some more info.
My program does not work for me either.
After selecting some cells in the List_View, the CANCEL button no longer works ? I'm not sure why.
You may need to provide a response to each of the call-back reasons
My example might help identify the problem.
You may need a menu to provide access to the modified data ?
Code: | winapp
program listbox
implicit none
character (len=27), dimension(16) :: lvdata
integer :: i
!
integer, dimension(16) :: selection
integer callback_count, view
common /zz/ callback_count, view, selection
!
integer cancel, callback
external cancel, callback
!
callback_count = 0
selection = 0
view = 1
!
lvdata(1) = '|Head1_80|Head2_80|Head3_80'
do i=2,15
lvdata(i) = '|DataX|DataY|DataZ'
enddo
lvdata(16) = ' '
!
i = winio@ ('%^lv[edit_cells]&', 380,150, lvdata, 16, selection, view, callback)
i = winio@ ('%ff%nl%cn%^8bt[Cancel]', cancel)
!
end program listbox
integer function cancel()
implicit none
cancel=0
end function cancel
integer function callback()
implicit none
!
integer, dimension(16) :: selection
integer callback_count, view
common /zz/ callback_count, view, selection
!
CHARACTER CLEARWIN_STRING@*30, ANSWER*30
external CLEARWIN_STRING@
!
answer = CLEARWIN_STRING@ ('CALLBACK_REASON')
!
callback_count = callback_count + 1
callback = 2
write (*,fmt='(a,20i2)') 'Sel = ',selection
write (*,*) 'Callback entered :',answer,callback_count, view
!
end function callback |
|
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Fri Jul 15, 2011 1:30 pm Post subject: |
|
|
Quote: | OK. I can see the problem now and will aim to fix it. |
Thank you!
Quote: | You may need to provide a response to each of the call-back reasons |
The callbacks are begin edit and end edit, no idea what response you'd create for them to magically get the cancel button to work... |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2593 Location: Sydney
|
Posted: Sun Jul 17, 2011 1:38 am Post subject: |
|
|
I am finding that CALLBACK is interupting a previous interrupt to CALLBACK, before the first is completed.
Should these interrupts be occuring so quickly ?
Can the second interrupt be delayed until the first has completed ?
Quicker exit from interrupts that require no response may help, but I think the problem would still remain.
I was not able to store changes to the cells so do you need more than a single %lv to get this to work properly with [edit_cells] ?
Just some ideas I thought may help. I'm sorry that I don't have the solution.
John |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Tue Aug 02, 2011 9:06 am Post subject: |
|
|
I have started work on this problem but can nolonger get it to fail.
Here is my test program which for me consistently requires just one click on Cancel. Can you retest this for me and supply a version that exhibits the problem.
Code: | winapp
program listbox
implicit none
integer, dimension(15) :: selection
character (len=18), dimension(16) ::lvdata
integer :: view, i
external cancel, callback
integer cancel, callback
selection = 0
view = 1
lvdata(1) = '|Head1|Head2|Head3'
do i=2,16
lvdata(i) = '|DataX|DataY|DataZ'
enddo
i = winio@ ('%^lv[edit_cells]&', 380,100, lvdata, 16, selection, view, callback)
i = winio@ ('%ff%nl%cn%^8bt[Cancel]', cancel)
end program listbox
integer function cancel()
integer k
save k
data k/0/
k = k+1
print*, "Cancel" ,k
cancel=1
end function cancel
integer function callback()
include <windows.ins>
character*80 reason
integer kk
save kk
data kk/0/
kk = kk+1
reason = clearwin_string@("callback_reason");
print*, reason, kk
callback = 2
end function callback |
|
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Wed Aug 03, 2011 7:32 am Post subject: |
|
|
Quote: | Here is my test program which for me consistently requires just one click on Cancel. |
Fails on my system. First click on >Cancel< triggers an end edit+begin edit if the list view is in edit mode. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Wed Aug 03, 2011 12:32 pm Post subject: |
|
|
I have now managed to fix this bug for the next release of salflibc.dll. |
|
Back to top |
|
|
Sebastian
Joined: 20 Feb 2008 Posts: 177
|
Posted: Wed Aug 03, 2011 1:27 pm Post subject: |
|
|
Nice, thanks! |
|
Back to top |
|
|
|