replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Same button, many functions.
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 

Same button, many functions.

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Fri Mar 14, 2014 11:01 am    Post subject: Same button, many functions. Reply with quote

G'day, folks Very Happy

Can ClearWin do this?

In a program such as Piriform's CCleaner the same button can assume many functions, according to the task selected.

For instance, without changing either its location or its appearance, it can successively denote 'Analyze', 'Cancel', 'Scan for issues', and 'Cancel scan'.

That certainly makes for very efficient use of window area, something I'd like to use in my programs. I was wondering if it's something that ClearWin could already achieve.

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Fri Mar 14, 2014 11:36 am    Post subject: Reply with quote

Yes. You attach a callback function to the button.
You need some mechanism to set a flag to indicate the response required then the callback can use the flag to carry out the selected task.

You can also change the text on the button depending on the flag by calling change_button_text@. For this you need to use %lc immediately after %bt or %bb or %tt.
Back to top
View user's profile Send private message AIM Address
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Sat Mar 15, 2014 6:41 pm    Post subject: Re: Reply with quote

PaulLaidler wrote:
Yes. You attach a callback function to the button.
You need some mechanism to set a flag to indicate the response required then the callback can use the flag to carry out the selected task.

You can also change the text on the button depending on the flag by calling change_button_text@. For this you need to use %lc immediately after %bt or %bb or %tt.


Thankyou Smile Unfortunately I couldn't find any mention of the syntax for change_button_text@ in my manual's list of Library References (Chapter 27). The only 'change' items described are change_hypertext@ and change_pen@.

Thinking my manual could be out-of-date I checked at http://www.silverfrost.com/manuals/clearwin.pdf but couldn't find any mention there, either.

change_button_text@ sounds exactly what I need. Would you mind posting the syntax for this very useful operation? Thanks, in advance Very Happy

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Wilfried Linder



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

PostPosted: Sat Mar 15, 2014 7:07 pm    Post subject: Reply with quote

Maybe this is what you are looking for:
http://www.silverfrost.com/ftn95-help/clearwinp/library/change_button_text_.aspx
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Sat Mar 15, 2014 8:17 pm    Post subject: Reply with quote

At the risk of stating the obvious, you only get one callback function per button, and you need to keep a tally of which caption is on the button at any moment in time, and the callback has to address all possibilities.

The Windows User Interface Guidelines say "Don't do it", but then Microsoft doesn't obey its own rules!

As well as the printed documentation, you also need to refer to FTN95.CHM, and one of my personal favourites for unexpected gems, the cwplus.enh file (in the docs folder of ftn95) - this gives a list of enhancements to Clearwin+ over many years. Read it and you'll discover lots of things!

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



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Sat Mar 15, 2014 8:22 pm    Post subject: Re: Reply with quote

Wilfried Linder wrote:
Maybe this is what you are looking for:
http://www.silverfrost.com/ftn95-help/clearwinp/library/change_button_text_.aspx


Yes, that looks to be remarkably close to what I'm looking for Very Happy Thankyou, Wilfried!

It also highlights that I need the Clearwin+ Users Guide, not just the manual.

Thanks again Very Happy

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Sat Mar 15, 2014 8:28 pm    Post subject: Re: Reply with quote

LitusSaxonicum wrote:

As well as the printed documentation, you also need to refer to FTN95.CHM, and one of my personal favourites for unexpected gems, the cwplus.enh file (in the docs folder of ftn95) - this gives a list of enhancements to Clearwin+ over many years. Read it and you'll discover lots of things!
Eddie


Looks like I have a voyage of discovery ahead of me Very Happy Many thanks, Eddie!

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Sat Mar 15, 2014 9:17 pm    Post subject: Constant-size button Reply with quote

An interesting footnote to the change_button_text discussion is that the compiler, or whatever, can 'sense' in advance what will be the longest text string.

It's my casual observation, post-discussion, that the button size (width) is unchanged as the length of the text string varies.

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sun Mar 16, 2014 9:43 am    Post subject: Reply with quote

Yes. When you change the button text dynamically, the button size will not change automatically. But there are functions to move the button and change its size.

The simplest way would be to compile using the button text that is longest and then change to the desired start up text using change_button_text@ within a %sc callback. The button will then be big enough for every case and the text will be automatically centred in the button.
Back to top
View user's profile Send private message AIM Address
eric_carwardine



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Sun Mar 16, 2014 11:24 am    Post subject: Re: Reply with quote

Thankyou Very Happy

PaulLaidler wrote:
... But there are functions to move the button and change its size...


That reminds me of a 'survey' in which every choice (button) except one did a random jump to a new location whenever the mouse was hovered over it Very Happy

Seriously, though, consider a program which is compiled with the longest button text. Now, to be effective, where in relation to %bt should %sc be placed? %sc BEFORE %bt or %sc AFTER %bt

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LitusSaxonicum



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

PostPosted: Sun Mar 16, 2014 1:10 pm    Post subject: Reply with quote

Eric,

It doesn't matter, although for organisational reasons I usually start with anything to do with style, then follow with %sc and the variants of %cc (%cc and %`cc) before getting round to layout and controls. Indeed, I usually put all the 'style' format codes in a subroutine and call that immediately after %ca so that all my windows have common attributes which I get hold of in one line (although if you like lots of format codes in one line you do it as you see fit). My personal experience is that too many format codes in one line make the source look ugly and difficult to follow.

Also in my experience, different button styles (%bt, %tt, %bb etc) have different width-sizing rules, and some of them have bigger size jumps than others. If you want a lot all the same width you need to think carefully. One way to make %bt buttons all the same size is to specify the size on each e.g. %6bt and also make use of %ob[invisible] ... %cb to get them to line up vertically.

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



Joined: 13 Jun 2009
Posts: 70
Location: Perth, Western Australia

PostPosted: Mon Mar 17, 2014 1:36 am    Post subject: Re: Reply with quote

LitusSaxonicum wrote:
... make the source look ugly and difficult to follow.


Thankyou Eddie Very Happy

The term 'self-documenting' comes to mind, but I get your point. It's important to remember that more than an inanimate compiler may want to understand what we've written.

Eric
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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