Paul, is it possible to have the %ud attached to a child window? Either used as as a %ch or %ps? That would make it more like a regular window, and get_user_data@() would be appropriate.
If not, I understand. Thought I'd ask!
Bill
Welcome to our forums
Paul, is it possible to have the %ud attached to a child window? Either used as as a %ch or %ps? That would make it more like a regular window, and get_user_data@() would be appropriate.
If not, I understand. Thought I'd ask!
Bill
Bill
You should be able to use %ud after %sh to set the user data for the sheet but you will need to call GET_USER_DATA@ using the corresponding %hw Windows HWND in order to retrieve the data.
Paul, thanks for the hint. I wrote a small sample program for my %ps usage (below) with both individual sheets as well as a sheet array specified. In both cases, the last sheet in the %ps list gets the %ud. In one way, this is kinda cool because you could tell how many sheets you have by finding which one has data attached to it. But not quite what I had expected.
I'll try individual child window creation next and post my results next.
winapp
program cmain
use mswin
integer:: i,j=2,k=10,l=30
integer,external:: button1,button2
integer:: ps(3),rh(4)
common/sheet_test/ps,rh
print *,'First way of attaching sheets to a %ps'
i = winio@('%sh%ud%hw&',ps(1),1,rh(1))
i = winio@('%ca[First]%rd',j)
i = winio@('%sh%ud%hw&',ps(2),2,rh(2))
i = winio@('%ca[Second]%rd',k)
i = winio@('%sh%ud%hw&',ps(3),3,rh(3))
i = winio@('%ca[Third]%rd',l)
i = winio@('First way of attaching sheets to a %%ps (individual sheets)%2nl&')
i = winio@('%^3ps%ud%hw%2nl&',ps(1),ps(2),ps(3),button2,99,rh(4))
i = winio@('%^bt[print_handles]',button1)
print *,'Second way of attaching sheets to a %ps'
i = winio@('%sh%ud%hw&',ps(1),10,rh(1))
i = winio@('%ca[First]%rd',j)
i = winio@('%sh%ud%hw&',ps(2),20,rh(2))
i = winio@('%ca[Second]%rd',k)
i = winio@('%sh%ud%hw&',ps(3),30,rh(3))
i = winio@('%ca[Third]%rd',l)
i = winio@('Second way of attaching sheets to a %%ps (sheet array)%2nl&')
i = winio@('%~^3ps%ud%hw%2nl&',ps,button2,-99,rh(4))
i = winio@('%^bt[print_handles]',button1)
end
INTEGER(KIND=7) FUNCTION BUTTON1()
integer:: ps(3),rh(4)
common/sheet_test/ps,rh
BUTTON1= 1
print *,'Button_press rh=',rh
RETURN
END
INTEGER(KIND=7) FUNCTION BUTTON2()
use mswin
integer:: ps(3),rh(4),j
common/sheet_test/ps,rh
BUTTON2= 1
j= clearwin_info@('SHEET_NO')
print *,j,'Button2-1 rh=',rh(j),get_user_data@(rh(j)),get_user_data@(rh(4)),get_user_data@(clearwin_info@('CALL_BACK_WINDOW'))
RETURN
END
Using the %ch to create the child windows, the %ud associated with the definition of the sheet (%sh) is ignored. When associated with the %ch, however, the %ud is used.
So, I guess the question is: how to attach a user data field to a sheet when used in a %ps. Or, is that possible?
winapp
program cmain
use mswin
integer:: i,j=2,k=10,l=30
integer,external:: button1,button2
integer:: ps(3),rh(4),ch(3)
common/sheet_test/ps,rh,ch
ps = 0
rh=0
ch=0
print *,'First way of attaching sheets with a %ch'
i = winio@('%sh%ud%hw&',ps(1),1,rh(1))
i = winio@('%ca[First]%^rd',j,button1)
i = winio@('%sh%ud%hw&',ps(2),2,rh(2))
i = winio@('%ca[Second]%^rd',k,button1)
i = winio@('%sh%ud%hw&',ps(3),3,rh(3))
i = winio@('%ca[Third]%^rd',l,button1)
i = winio@('First way of attaching sheets with a %%ch%2nl&')
i = winio@('%ch%ud&',ps(1),10)
i = winio@('%ch%ud&',ps(2),20)
i = winio@('%ch%ud&',ps(3),30)
i = winio@('%^bt[print_handles]',button1)
end
INTEGER(KIND=7) FUNCTION BUTTON1()
use mswin
integer:: ps(3),rh(4),ch(3)
common/sheet_test/ps,rh,ch
BUTTON1= 1
print *,'ps=',ps
print *,'rh=',rh
print *,'ud=',get_user_data@(rh(1)),get_user_data@(rh(2)),get_user_data@(rh(3))
RETURN
END
Bill
I have found it necessary to modify the code for get_user_data@ in order to get this to work. So you will need the next release of ClearWin+.
Here is my code for the test case based on your programs...
program cmain
use mswin
integer:: i,j=2,k=10,l=30
integer,external::cb
integer:: ps(3)
integer(7)::rh(3),d(3)
common/sheet_test/ps,rh
d(1) = 10;d(2) = 20;d(3) = 30;
i = winio@('%sh%ud%hw&',ps(1),d(1),rh(1))
i = winio@('%ca[First]%rd',j)
i = winio@('%sh%ud%hw&',ps(2),d(2),rh(2))
i = winio@('%ca[Second]%rd',k)
i = winio@('%sh%ud%hw&',ps(3),d(3),rh(3))
i = winio@('%ca[Third]%rd',l)
i = winio@('%^3ps',ps(1),ps(2),ps(3),cb)
end
integer function cb()
use mswin
integer:: ps(3)
integer(7)::rh(3)
common/sheet_test/ps,rh
j= clearwin_info@('SHEET_NO')
print *,j,get_user_data@(rh(j))
cb= 2
end
Thanks, Paul! It is worth the wait; I have a kludge in place to do what I need to do, and this will make it all the better!
Much appreciated, and stay safe, Bill