WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Dialog Editor Fonts

Keywords:   Dialog Editor Font AskFont GUI fonts

Question:

For WilDialogs the font size seems to be in the 2nd position in the | deliminated list? But how does the number correlated to the font size that was selected? Example I pick 10 and its 6656 in the code.

Askfont - I may be missing something but it seems like it would make sense to have a return value that works with the WilDialogs. Do I need to reformat the its value in some obscure way to plug into a WilDialog?

Answer:

Sorry AskFont doesn't currently support returning the exact format needed by WIL Dialogs. The developers are aware of the request.

Dialog font descriptions are not the standard Windows font description by design. Our developers spent some time trying to find a font height representation that would work across systems with different display resolutions and sizes. This is needed to allow fonts to scale the same way dialogs do when they are displayed on different systems with different display metrics. In the end we found a simple formula that works well. We do not want AskFont to always return a dialog font style string because then it would not work for anything else. I suppose someday we could add another magic format switch to AskFont that would cause the function to return Dialog Fonts descriptions. But until that day comes you can easily convert the height from the AskFont pixels to Dialog special font units using the following formula

nAskFontHeight = -17
FontSize = int(Abs(nAskFontHeight * 1024) / WinMetrics(-5))
;WIL DIALOG      FontName | FontSize | Weight | Face
;ASKFONT         LogFont [@TAB] PointSize [@TAB] Color [@TAB] FontType

;AskFont format converted to WIL Dialog font format
type=0
flags=0
customkeyword="sample"
format=0
MyFont=AskFont( type, flags, customkeyword, format )

Message("AskFont return value is",MyFont)

FontName = ItemExtract(-1, ItemExtract(1,Myfont,@TAB), "|")
; PROBLEM: Figure out how to convert font size returned from AskFont to WIL Dialog Format
nAskFontHeight = ItemExtract(1, ItemExtract(1,Myfont,@TAB), "|")
FontSize = Int(Abs(nAskFontHeight * 1024) / WinMetrics(-5))
; Sample Results
; DisplaySz   Askfont   Dialog
; 8         80       5632
; 9         90         6144  {note these values differ by 512}
;10         100      6656
;
Weight = ItemExtract(5, ItemExtract(1,Myfont,@TAB), "|")/10
Face =  ItemExtract(13, ItemExtract(1,Myfont,@TAB), "|")

fontdata = FontName:"|":FontSize:"|":Weight:"|":Face

MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`WIL Dialog 1`
MyDialogX=019
MyDialogY=076
MyDialogWidth=566
MyDialogHeight=243
MyDialogNumControls=003
MyDialogProcedure=`DEFAULT`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,DEFAULT`
MyDialogConfig=0

MyDialog001=`165,223,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`365,223,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog003=`079,107,304,012,VARYTEXT,"VaryText_1",customkeyword,"",DEFAULT,30,DEFAULT,"`:fontdata:`",DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")
Exit




Question:

The default font used in constructing dialogs in the Dialog Editor is very different from that used in displaying the dialog, not at all WYSIWIG. I haven't been able to find how to change either one. The display font is fine. You get something that looks ok in the editor and is very different when you run the program. What am I missing?

Answer:

The 97D version of the Dialog editor has a menu item under EDIT (I think) to allow you to switch fonts.

The story is that both Windows and WinBatch are moving to "GUI" fonts. But the old Windows and old WinBatch used different fonts. So there will be some disasters in the conversion process, especially if you have to support both old and new platforms.

Basically for Windows 95 and NT 4.0, the default is GUI fonts. The new dialog editor defaults the same way.

There is an IntControl that can force the old style fonts.

Question (continued):

I encountered the same, and when I looked at it, I discovered that while the default is supposed to be GUI in 97D, I had to explicitly enter IntControl(52,1,0,0,0) into the script for the GUI to work, at least from outside the compiler.

It is almost as if the GUI mode was made the default in the compiler but not in Winbatch.exe in 97D.

Putting the line into the script before the dialog worked.

Answer:

Should work. Check to make sure you don't have an old version of WinBatch involved somehow.

By the way, the Intcontrol(52,... may not be documented in the older versions of the WIL.HLP file. Here's the syntax:



    IntControl(52, p1, 0, 0, 0) (32-bit only)
      Set dialog font.

        P1   Meaning
        --   -------
        -1   Don't change (just return current setting)
	 0   Use standard system font.
	 1   Use GUI font (default).

      This IntControl lets you specify whether the standard system font or
      GUI font is used by dialog boxes created with the Dialog command.	 By
      default, the GUI font is used.

	Note: The GUI font is available only in Windows 95 and Windows NT 4.0.

      Returns previous setting.


Question:

What is the difference between the GUI and the System Font (besides size)? I want to move to using the GUI font but want to make sure that it will not change on different end users terminals. In particular, I want to be sure it won't get truncated or the layout changed on different Windows configurations.

Answer:

The GUI font seems a bit smaller and nicer looking. It varies - like the system font- on a system by system basis. In your video driver setup you can usually choose small or large font. This affects all kinds of things.

The basic rule is don't try to shave stuff too closely. If you are really paranoid about it, look at it in the VGA 640x480 video mode. It usually brings out the worst of problems.

From a layout and editing standpoint, fireup your word processor and type in a paragraph in a monospaced font (system font or courier ) which is usually spaced in cpi (characters per inch). These are also called typewriter fonts because they are the only kind most typewriters can do. Compare that with a proportional font (arial or Times Roman, say), which are measured in points.

You will notice that proportional (GUI) fonts vary the spacing between different leters and words, and the characters are not in vertical strips, as they are with monospaced fonts. You will notice that becasue of the proportional spacing, that more characters fit in a horizontal line than with monospaced fonts, even though the character height of 12 pts is roughly the same as 10 characters per inch. Also, many people, particularly those with dyslexia or other learning differences, have difficulty with monospaced fonts because the spaces between words often tends to look like "rivers" if the paragraph is long enough.

As a basic rule, if you go from system font to gui font of the same point size or equivalent cpi, you will need less width for the proportional font.

The only trouble I have found in converting has been in the case of a dialog() box where I needed to line up radio buttons with non-radio button descriptions (I used variables so that 5 choices were always named, but radio buttons only occured beside some buttons. This did not like gui fonts too much.)


Article ID:   W12842
Filename:   Fonts used in Dialog Editor.txt
File Created: 2012:01:13:15:44:22
Last Updated: 2012:01:13:15:44:22