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 

Address of data being modified by a control
Goto page Previous  1, 2
 
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: 657
Location: Morrison, CO, USA

PostPosted: Thu Dec 13, 2018 5:23 pm    Post subject: Reply with quote

Thanks for taking a look, Paul. I'll pursue other options.
Back to top
View user's profile Send private message Visit poster's website
wahorger



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

PostPosted: Fri Dec 14, 2018 10:10 pm    Post subject: Reply with quote

Paul, I am attempting to use this feature with a %ls, but the value returned is always zero.

Are there some controls for which no assignment of User_Data can be made?
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sat Dec 15, 2018 9:00 am    Post subject: Reply with quote

No. It should work for any control.

Can you post some code that illustrates the failure?
Back to top
View user's profile Send private message
wahorger



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

PostPosted: Sat Dec 15, 2018 3:50 pm    Post subject: Reply with quote

I used your code, and added the %ls construct. The intent was do decrement "data2" when either (a) data1 was modified, or (b) when a list element was selected.

The address returned was zero (error thrown) when the list was selected.

Code:
!    PROGRAM Simple
 WINAPP
 program main
 integer iw,winio@
 character*1024 buffer
 character*10 list_elements(5)
 integer list_sel
 integer data1,data2
 integer,external::cb ,cb2
 data1 = 0
 data2 = 0
 buffer = " "
 list_elements = 'abcd defg'
 list_sel = 1
 iw = winio@("%ca[User data]&")
 iw = winio@("%30.10^re%ff&",buffer,cb)
 iw = winio@("%ud&", loc(data1))
 iw = winio@("%ff%nl%cn&")
 iw = winio@("%^10rd&",data1,cb2)
 iw = winio@('%ud&',loc(data2))
 iw = winio@('%10rd&',data2)
 iw = winio@('%ff%nl%^10.10ls&',list_elements,5,list_sel,cb2)
 iw = winio@('%ud&',loc(data2))
 iw = winio@(' ')
 print *,data2
 end
 
 integer function cb()
 use clrwin
 integer(7) addr
 addr = clearwin_info@("USER_DATA")
 core4(addr) = core4(addr)+1
 cb = 1
 end function

 integer function cb2()
 use clrwin
 integer(7) addr
 addr = clearwin_info@("USER_DATA")
 core4(addr) = core4(addr)-1
 cb2 = 1
 end function
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sat Dec 15, 2018 6:33 pm    Post subject: Reply with quote

Yes. This fails and I have fixed it in ClearWin+. I will aim to send new DLLs early next week.

I think that you probably don't need the line..

Code:
iw = winio@('%ud&',loc(data2))


at about line 20.
Back to top
View user's profile Send private message
wahorger



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

PostPosted: Sat Dec 15, 2018 10:48 pm    Post subject: Reply with quote

The intent was to see, if it worked, that the callback had the correct pointer to the data for that rd field. Obviously, didn't need it, but if it had worked, I wanted to know!

Thanks for all the work. As I go through my code, I'll be adding in the %ud calls to other controls. The way I'm structuring the recode, I retain the existing code to populate various variables, and when the callback is successful with "USER_DATA", I'll begin larger changes. In this case, the %ls was my first set to begin!

Again, many thanks!
Bill
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Tue Dec 18, 2018 4:17 pm    Post subject: Reply with quote

Bill

Here is a new set of DLLs for you to try....

https://www.dropbox.com/s/9wl57uvg1ct9hp8/newDLLs28.zip?dl=0
Back to top
View user's profile Send private message
wahorger



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

PostPosted: Wed Dec 19, 2018 1:16 am    Post subject: Reply with quote

Paul,

YEAH! This works well. Thank you!

One note: The way I constructed my winio@() calls, except for the first one, used %ob to force formatting. The %ud was then AFTER the %cb. What this did was attach the User Data to the %cb (maybe?).

I restructured my winio@() calls to place the %cb after the %ud, and all is now well.

Just a programming note perhaps for the on-line help.

Again, many thanks.
Bill
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Wed Dec 19, 2018 8:05 am    Post subject: Reply with quote

Thanks Bill. I can probably fix the problem with %ob/%cb in the ClearWin+ coding.
Back to top
View user's profile Send private message
wahorger



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

PostPosted: Wed Dec 19, 2018 2:37 pm    Post subject: Reply with quote

Thanks, Paul!
Back to top
View user's profile Send private message Visit poster's website
wahorger



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

PostPosted: Tue Jul 23, 2019 1:26 am    Post subject: Reply with quote

I just wanted to give an update on the use and utility of %ud.

I have a selection that consists of a list select that identifies the category of the data the user can select, then a list view of the data already existing for that category. The functions provided allow for selection of a data item from the list view (fills in specific data into the calling program), edit one or more existing items in the list view, delete one or more existing items in the list view, and add a new item to the current category. It is one of the more complicated sets of controls because there is a generalized ENABLE for the functionality as well as allowing only the data fields for the selected category to be enabled via the list select. Also, the list view can sort on the individual data fields to provide the user with greater functionality. Unfortunately, I have to cobble together a wrapper for applying these data functions to different data, compounding the debugging process.

The old code used labeled COMMON extensively to pass back and forth the various grey controls, data items, etc. And it was limited to only labeled COMMON. 895 lines of code. Getting the code to act only a different set of data required an entirely new set of interface and callback routines.

Using the %ud, I have been able to recreate all that functionality in 733 lines of code. Not much of a reduction really. But, it is much cleaner, more easily read (and debugged). And here is the best part, I am no longer constrained by the code to ask for one set of data that gets stored in one location. I can define a TYPE and its elements to point to whatever target data I need to populate. It is almost as if this complex set of data controls is now acting as a single control, driven by the TYPE associated with the control(s).

So, Paul and the folks at Silverfrost, thanks for providing such a useful new feature. It has and will save me countless hours of debugging time.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Jul 25, 2019 8:02 am    Post subject: Reply with quote

Bill

I can't see why %ud is not working correctly relative to %cb.

If you want to post a sample that illustrates the failure then I might be able to fix it.
Back to top
View user's profile Send private message
wahorger



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

PostPosted: Thu Jul 25, 2019 12:47 pm    Post subject: Reply with quote

Paul, I'll try to construct something that is simple. It was so long ago, I've forgotten what module it was in! It will likely be a few to several days (unless the grandchildren stay asleep a while longer!).

Bill
Back to top
View user's profile Send private message Visit poster's website
wahorger



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

PostPosted: Fri Jul 26, 2019 1:43 pm    Post subject: Reply with quote

Well, I cannot replicate the issue either with a %rd or a %ls control followed by the %ud either before or after a %cb. Until I have something else to confirm, I think you can take it off of your list.

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
Goto page Previous  1, 2
Page 2 of 2

 
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