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 

Adding %ud to %sh?

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



Joined: 13 Oct 2014
Posts: 818
Location: Morrison, CO, USA

PostPosted: Sun Apr 05, 2020 12:16 am    Post subject: Adding %ud to %sh? Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sun Apr 05, 2020 8:45 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 818
Location: Morrison, CO, USA

PostPosted: Sun Apr 05, 2020 2:30 pm    Post subject: Reply with quote

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.

Code:
   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
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 818
Location: Morrison, CO, USA

PostPosted: Sun Apr 05, 2020 2:51 pm    Post subject: Reply with quote

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?

Code:
   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
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Mon Apr 06, 2020 9:24 am    Post subject: Reply with quote

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...

Code:
   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
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 818
Location: Morrison, CO, USA

PostPosted: Tue Apr 07, 2020 12:17 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
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