AutoHotkey Community

It is currently May 27th, 2012, 1:00 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: October 23rd, 2011, 1:49 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
I've come across a need to save current font options and font face to restore at a later time.

My case:

The user passes a font options string that is later used to set a control to that font with Gui, Font, %fontoptions%.

The problem is that if the user doesn't specify size/color and then Gui, Font is called later that does change the size/color (perhaps for another control), changing the font with the user's font options string changes the size/color that was to that of the most recent call to Gui, Font, not that which was in effect at the time of the user's call, which would be most logical from the user's perspective.

See my post in Placeholder(), 6th paragraph.

Another hypothetical case:

A subroutine/function that changes the font for something, and then would ideally change the font back before it returned. I.e. keep side-effects of calls to a minimum.

This is the same logic as saving thread options for things like A_IsCritical, A_BatchLines, A_TitleMatchMode, and A_FormatInteger (though personally I like using the format() function from v2 lib since it's been released, even in 1.1) to restore at the end of a function/subroutine call.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group