forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Listview+Button hangs

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Sebastian



Joined: 20 Feb 2008
Posts: 177

PostPosted: Thu Jul 14, 2011 7:56 am    Post subject: Listview+Button hangs Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5542
Location: Salford, UK

PostPosted: Thu Jul 14, 2011 12:28 pm    Post subject: Reply with quote

You need

Code:
   integer cancel, callback



in your program.
Back to top
View user's profile Send private message
Sebastian



Joined: 20 Feb 2008
Posts: 177

PostPosted: Thu Jul 14, 2011 3:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1854
Location: Yateley, Hants, UK

PostPosted: Thu Jul 14, 2011 5:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5542
Location: Salford, UK

PostPosted: Thu Jul 14, 2011 6:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sebastian



Joined: 20 Feb 2008
Posts: 177

PostPosted: Fri Jul 15, 2011 7:22 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5542
Location: Salford, UK

PostPosted: Fri Jul 15, 2011 9:47 am    Post subject: Reply with quote

OK. I can see the problem now and will aim to fix it.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 1994
Location: Sydney

PostPosted: Fri Jul 15, 2011 9:51 am    Post subject: Reply with quote

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
View user's profile Send private message
Sebastian



Joined: 20 Feb 2008
Posts: 177

PostPosted: Fri Jul 15, 2011 1:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 1994
Location: Sydney

PostPosted: Sun Jul 17, 2011 1:38 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5542
Location: Salford, UK

PostPosted: Tue Aug 02, 2011 9:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Sebastian



Joined: 20 Feb 2008
Posts: 177

PostPosted: Wed Aug 03, 2011 7:32 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5542
Location: Salford, UK

PostPosted: Wed Aug 03, 2011 12:32 pm    Post subject: Reply with quote

I have now managed to fix this bug for the next release of salflibc.dll.
Back to top
View user's profile Send private message
Sebastian



Joined: 20 Feb 2008
Posts: 177

PostPosted: Wed Aug 03, 2011 1:27 pm    Post subject: Reply with quote

Nice, thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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