Symbols on dialog? 
Author Message
 Symbols on dialog?

I want to display some special characters/symbols on my
dialog static controls such as alpha, beta. Is it
possible? How can I do it?

Thanks,
Joseph



Mon, 25 Apr 2005 11:38:56 GMT  
 Symbols on dialog?
Joseph

Use the character map application to find a suitable font and characters for
your purpose. Cut and paste the chars to your static controls in your
dialog. I use the Symbol font.

Create a CFont member variable in your dialog class, and initialise it in
your WM_INITDIALOG handler. I get a LOGFONT struct from the dialog font so I
can change the font characteristics for the dialog if I wish later, and have
any changes reflected in the font used for the special characters.

e.g.

<code>
 CFont* pDlgFont = GetFont();

 ASSERT(pDlgFont != NULL);

 LOGFONT lf;
 ZeroMemory(&lf, sizeof(LOGFONT));

 VERIFY(pDlgFont->GetLogFont(&lf));

 ZeroMemory(lf.lfFaceName, LF_FACESIZE);
 ::strcpy(lf.lfFaceName, "Symbol");  // Font face name here

 VERIFY(m_fntGreek.CreateFontIndirect(&lf));

 m_ctrlGreek.SetFont(&m_fntGreek);
</code>

James


Quote:
> I want to display some special characters/symbols on my
> dialog static controls such as alpha, beta. Is it
> possible? How can I do it?

> Thanks,
> Joseph



Mon, 25 Apr 2005 14:53:05 GMT  
 Symbols on dialog?
Be aware that if you are sending your app out to someone else that you restrict yourself
to the standard fornts, e.g., for alpha and beta, use only the Symbol font.

Getting mixed text is hard, however. If you needed to say something like
        [alpha]-test date:
        [beta]-test date:

you are in trouble. If you were to use Unicode you could probably do it, although I've
never tried this approach. What I've done is preempt some of the unused characters in the
character map and use an otherwise unused position (e.g., between 129 and 159, according
to my current character map) and use that to represent the alpha or beta. Then I write my
own OnPaint handler for the static control, parse the string, and draw the text in pieces;
for example, I show all the text up to the [alpha] placeholder, switch to symbol and
display an alpha, then switch back and continue displaying. TextOut and GetTextExtent are
heaving used here. I also used this same technique to show musical key designators, e.g.,
        A#
        Bb
        FN
        Ax
        Bd

where I translate # and b to the musical symbols (turns out they are characters # and b in
the music font I'm using) N to the natural sign, x to the double-sharp sign, and d to the
double-flat sign. You can see this if you go to www.guitaronemag.com and download the
version of transkriber that this there (I think they now have the latest version up)
                                joe

Quote:

>Joseph

>Use the character map application to find a suitable font and characters for
>your purpose. Cut and paste the chars to your static controls in your
>dialog. I use the Symbol font.

>Create a CFont member variable in your dialog class, and initialise it in
>your WM_INITDIALOG handler. I get a LOGFONT struct from the dialog font so I
>can change the font characteristics for the dialog if I wish later, and have
>any changes reflected in the font used for the special characters.

>e.g.

><code>
> CFont* pDlgFont = GetFont();

> ASSERT(pDlgFont != NULL);

> LOGFONT lf;
> ZeroMemory(&lf, sizeof(LOGFONT));

> VERIFY(pDlgFont->GetLogFont(&lf));

> ZeroMemory(lf.lfFaceName, LF_FACESIZE);
> ::strcpy(lf.lfFaceName, "Symbol");  // Font face name here

> VERIFY(m_fntGreek.CreateFontIndirect(&lf));

> m_ctrlGreek.SetFont(&m_fntGreek);
></code>

>James



>> I want to display some special characters/symbols on my
>> dialog static controls such as alpha, beta. Is it
>> possible? How can I do it?

>> Thanks,
>> Joseph

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Mon, 25 Apr 2005 18:27:45 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Copyright Symbol in Dialog

2. Putting dialog symbols in controls

3. MFC-dialog from static library: GetEventSinkMap(): Unresolved symbol

4. Annoying dialog while debugging: Symbol not found

5. Symbol in a Dialog

6. Greek symbols for Static Text on dialog box

7. The bullet/symbol dialog

8. VC7: Using symbol server for symbols AND modules

9. Can VC6 read Windows symbols from Symbol Server

10. Symbols from Symbol Server

11. How do you point the VC++5 (SP3) debugger to use the win2K debugger symbols in the Winnt\Symbols directory.

12. Creating a symbol file

 

 
Powered by phpBB® Forum Software