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 

Call a subroutine when Edit Box (%eb) loses focus?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Mon Aug 11, 2008 5:00 pm    Post subject: Reply with quote

Quote:
Anybody know if a callback function can take an argument?



Sorry, no it can't. I use common blocks to get variables into callback functions (I know what I am doing with common blocks!)
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



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

PostPosted: Mon Aug 11, 2008 6:10 pm    Post subject: Reply with quote

Agree totally with John: callback functions take no parameters. It took me a long time to get that in my thick skull. And yes, I use named Common much more now than ever I did in the past. You can be systematic, and give the common areas names that look like the callback function they communicate with, so for callback TAKE_THE_MONEY you might have COMMON / TAKE_THE_MONEY_INFO / etc. They only need to be in the caller and "callee" routines.

Incidentally, in this forum if you want to lay something out in a fixed font, highlight it and click the "Code" button (above the input box). Use the "Preview" to look at it, and don't forget that you can edit your posts even after they have gone up.

I imagine that what you are doing is the same as many middle-aged folks - putting a Windows gloss on old code. By the time you have finished, you find that the old code is a rather inelegant microcosm of the new program!

Eddie
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 514
Location: Sunderland

PostPosted: Tue Aug 12, 2008 12:08 pm    Post subject: Reply with quote

Hi,
Sorry, I thought that you had your hex dump as an integer array, and it was that I meant with the character*1 version, not your original integer data array.

You can execute your "conversion back" routine when the callback which detects the hook_focus change, gives:
clearwin_info@('GAINING_FOCUS') == 1
It seems like a fun conversion routine, if your user deletes some of the spaces between data or adds more or generally messes around with the format.

What happens if the user makes an almighty mess of the changes, swaps to another window for some arbitary reason and then comes back, all your internal data will have changed.

Good luck

Ian
Back to top
View user's profile Send private message Send e-mail
LitusSaxonicum



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

PostPosted: Tue Aug 12, 2008 11:01 pm    Post subject: Reply with quote

Ian,

Surely you do all the edits on a "proxy" version of the data, and only when it is time to save do you overwrite the reference version. Reversion to the original then cancels all the steps.

Implementing an "undo" system requires more thought!

Eddie
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2629
Location: Sydney

PostPosted: Thu Aug 14, 2008 8:16 am    Post subject: Reply with quote

Eddie,

I must admit that I don't use a proxy version always. There is quite a bit of work in setting up the temporary values, then updating them if any have changed. If you use a callback to check the changes, then the overhead of setting up the variable list in common and providing the update rules, it can get a bit involved.

The simpler approach of putting the variable in the edit box is much quicker, especially if you want to quickly see the results.

I was also going to comment on problems I have had using callbacks on %^rd or with %il, but on now reading the manual I saw %co for the first time !!
I have used an edit box for a year variable, with %il limited to 1980 to 2020, and could never delete the field.
It's amazing what we keep on learning with clearwin !

John
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Thu Aug 14, 2008 11:11 am    Post subject: Reply with quote

Hi, I can give you the complete source code, button bitmaps etc. for a simple text editor programmed with FTN95 / ClearWin. I have no idea whether it is possible to upload small files here (all files zipped 17.7 KB). May be the only way is that you tell me your email address.

Regards, Wilfried
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Thu Aug 14, 2008 5:13 pm    Post subject: Reply with quote

John,

I have trouble with %il because the limits are not dynamic, and also you can't have the low and high limits the same. Often, I check the limits in the callback - they can then be dynamic, or the same.

The business of using proxy data means that you do have a one-step possibility for undoing changes. You can always go back to the previous save.

In particular, the Windows MDI (multiple document) business requires a complete data set for each "document". I normally reckon that users of scientific software can't do MDI, because you have to keep too many ideas in your mind simultaneously.

Eddie
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 -> Support 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