I want to change font of a menu item from bold to regular.
I looked few API's like
ModifyMenu
SetMenuItemInfo
but looks like there is no direct API to change the font.
Any suggestions whats the easiest and best way to do that.
At least as far as I know, this requires an owner-drawn menu. As mentioned in the link, if you're willing to code strictly to Vista and newer, owner-drawn menus aren't necessary as often as they used to be, but:Most developers still need to support XPThis case doesn't really fit what they're talking about anyway.
Related
I am using MFC to create a dialog project and trying to impart color to the buttons.
I came to know that the only way you can do is to make the button owner draw. OnCtlColor() does not work for buttons.
I am able to color the button overriding OnDrawItem , but the problem is that , in the process the 3D cool look (with slightly rounded corner that you get in Win7) is lost.
Is there any way to retain the native look and color the button on top of that?
This is not a trivial task. As long as you are using themed controls (what you want), you cannot do more than the theme allows.
You would have to re-implement drawing of the button on your own, making use of the theme API as much as possible to retain themed look, yet sneak-in your color.
Though note that you can hardly achieve anything better than, what .NET WinForms do, when you set the Button.BackColor:
See also question how to set Button BackColor?
Disassembling the WinForms ButtonStandardAdapter.PaintWorker will give you some idea and API you need to use. Beware, you need to do lots of coding!
For C++/MFC code check out Vista themed Owner-Drawn and Full-Custom Push/Menu/Image Buttons on CodeProject. Which probably actually does, what you want already (the SetBackgroundColor method), so you might reuse it.
I may need to change toolbar background, heading font and position.
Is it possible to do that with the standard CPToolbar? I was looking through the ThemeDescriptors.j, and there is nothing about a Toolbar.
It seams not so difficult to create my own. Should I go that way?
The toolbar isn't themeable as is (although, feel free to implement that for us. :) )
That said, you could do something like this depending on what exactly you want to do…
https://github.com/cappuccino/issues/blob/master/Client/AppController.j#L273
I want to put help buttons on all my windows, like this:
But when I put the help button in, the minimize/maximize buttons disappear. Does Windows forbid having the min/max buttons together with the help buttons? That would be disappointing because that would mean I could put the help button only on dialogs and not on frames.
If Windows does forbid this, it would be nice to see an official Microsoft document which talks about this policy.
It is not possible through setting windows styles. If you really wanted to you could set some hooks that would probably let you do what you want, but I would not recommend doing that. You can mimic the functionality of the help button by sending the WM_HELP message.
According to MSDN, the styles WS_MAXIMIZEBOX and WS_MINIMIZEBOX can not be combined with WS_EX_CONTEXTHELP.
Although it is true what daalbert says, with some effort it is indeed possible to draw just about anything properly on the window frame. Of course this is in no way "official" and the limitation that daalbert mentions still stands.
You can listen for WM_NCPAINT and draw the button yourself with the help of DrawFrameControl with DFC_BUTTON (which makes sure it will look like the real thing). Use WM_NCHITTEST and friends (WM_NC*BUTTON*) to find out whether the button you draw gets clicked.
So yes, it's technically possible to achieve what you want but usually not worth the extra effort.
Just wanted to have this on record for completeness.
I'm relatively new to Cocoa and I would like to implement the ability to add or delete items from a pop-up menu in the same way that the OS X System Preferences/Network Location pop-up works. Selecting the 'Edit Locations...' option rolls down a window that provides the ability to add to, or delete from the existing Location list. My interest in doing things this way is as much about conforming to the relevant Human Interface Guidelines as having a way to dynamically change the menu content. (I have no real problem with the 'background' coding side of things, it's the user interface that's my primary issue at this stage.)
Is this a standard IB View?
On the surface, I can't see anything appropriate, but maybe that's just my inexperience. I'm assuming that, because this is not an uncommon sort of requirement, the task should be pretty straightforward and that Apple, or someone, would even have a relevant code sample to show how to define such a window.
Can anyone point me in the right direction?
Sorry for the late answer. I found this tutorial: http://cocoadevcentral.com/articles/000014.php
I'm rebuilding a language selection interface for a multi-national website, and I'm beginning to think it might be better for usability to use a simple form drop down rather than the custom JavaScript drop down menu that they're currently using. Am I way off base here, or should I go with my instinct? What do you think?
Simple drop down has its advantages. When you let the browser decide what to do, instead of forcing it to do what you want via JS, then browsers for unique circumstances (such as mobile devices) will format the drop down as its native selector.
If the custom js menu provides no additional functionality then definitely go with the basic select menu. However, if there's a good reason to use the custom menu, consider implementing it in a way that uses progressive enhancement so you can be sure it provides the basic functionality for everyone and adds features for browsers that can support it.
Any user who reaches the page for setting languages, comes with a specific aim in mind. He already knows what language he wants to set here (just as in most forms people know what they want to fill in for their birth date).
For this reason, I would recommend a text box with autocomplete functionality. Here are the advantages:
a text-box with a type-ahead works much better than a dropdown in most cases when the user knows what his options are
a dropdown with searching for "R" functionality doesn't always work the same way for all browsers, and not all browsers implement searching for "RUS...." and beyond.
from a purely is-this-usable standpoint, the type-ahead will prove to be far more useful over time.
I wouldn't use a drop down for countries - they are cumbersome to use when the number of items are large (https://ux.stackexchange.com/questions/31738/what-is-the-maximum-recommended-number-of-item-to-put-in-a-drop-down-list).
The "start typing a letter" to jump directly to say Russia when pressing R is a great feature in drop down lists - although I suspect that this is a power user feature - one that a lot of users will be unaware of (basically because it's a hidden feature).
Check out this solution instead -
http://uxdesign.smashingmagazine.com/2011/11/10/redesigning-the-country-selector/
Cheers