Hi
I have set my document style to "Plain Document" and setting the document properties with "set-document-properties" proc in the start file after "applet" herlad like below ...
{document-style PlainDocument}
{set-document-properties
border-width=1pt,
border-color="gray",
font-family = "Arial",
font-size = 10pt,
font-style = "normal",
font-weight = "normal",
vstretch? = true,
hstretch? = true
}
But this font styles are NOT applying to my application globally.
I want a single place where I can change my application's font styles which will be applied to the whole application and its controls.
How to do that ?
Thank you
Maybe you don't consider the effect of control-appearance-changeable? option. Controls will look for their option values from look-and-feel rather than their option parent when the control-appearance-changeable? is false, the default value of it.
Thank you fukuta.
After adding the statement "control-appearance-changeable? = true" in my strat.curl file most of the controls got the font customization settings that I'm setting with "set-document-properties".
But few are still not getting affected with that too and taking some other default-font ![]()
I just want ALL controls should have same font, size, style which can be changed at one place.
Any pointer ?
What are some of the kinds of controls that are still not being affected by your font change?
Duke,
Correctly, its not for specific controls, rather at specific places.
For ex, some places CommandButton is obeying the Global font rule and some places it not.
Like, inside few http-forms, context-menus, tables, group boxes, and user defined packages (though I have not defined anything any specif settings locally for them).
And I cannot say its not happening for specific controls or at specific places.
But, I want my complete application should have ONE FONT EVERY WHERE (including popup dialogs) which MUST be configured at ONE PLACE.
Thank you
Dialogs (and some other containers) are affected another property named use-look-and-feel?. By default, use-look-and-feel?=true, dialogs also get their nonlocal option values from look-and-feel. Please set it to false and see the result.
yes ...
Now I'm seeing that, Dialogs and HttpForms are not obeying the rule and if I set "use-look-and-feel? = false" for them, then my global font setting is applying on them but all other look and feel/style settings are vanishing ![]()
I can't imagine your situation. I hope someone else solves your problem...
Curl is a system designed for building both documents and applications, and the requirements sometimes conflict. In particular, most windowing systems use one set of fonts for dialogs and a different set of fonts for the application. The application font is often user settable (so is the system font, but a change at that level affects all applications on the system). In Curl, controls have to live in both worlds. Sometimes they appear in the flow of a document, and sometimes they appear on a dialog, menu, or toolbar. This sounds like the problem you're running into.
Graphical objects in Curl usually inherit many properties, including the font attributes. Because they can be inherited, these properties are called "nonlocal options". Each object has an "option parent" from which it can inherit such options. In the case of a Control, the option parent is the "LookAndFeel" object. For other visual objects, the option parent is the graphical container of the object.
When you call set-document-properties, you are setting option values almost at the very top of the hierarchy (user preferences are the very top). So you haven't done anything about the controls. Three solutions come to mind.
As someone else suggested, you can set control-appearance-changeable?=true on each control, which tells the control to inherit from the container directly, ignoring the look and feel. You also have to set use-look-and-feel?=false on every Dialog, HttpForm, MenuBar, and MenuPane to tell these objects not to inherit from the look and feel.
A nicer solution that works in both 6.0 and 7.0 is the following procedure, which you can call in place of set-document-properties. It calls set-document-properties and then it iterates over the arguments to set the same options on the look and feel, which will insure that the same options are used on controls, dialogs, and so on.
The third solution is to use a style sheet, but that's another story.
{curl 6.0, 7.0 applet}
{define-proc public {set-properties-everywhere ...}:void
{set-document-properties {splice ...}}
{for (arg, keyword) in ... do
{if keyword != null then
{the-default-look-and-feel.set-option-by-name
{non-null keyword}, arg
}
else
{error Unrecognized argument: & arg}
}
}
}
{Dialog
margin = 9pt,
{VBox
spacing = 9pt,
{CommandButton},
{CommandButton control-appearance-changeable?=true},
{CheckButton},
{TextField}
}
}
{CommandButton
label = Change All,
{on Action do
{set-properties-everywhere
border-width=1pt,
border-color=gray,
font-family = Times New Roman,
font-size = 10pt,
font-style = normal,
font-weight = normal
}
}
}
Note that this sets the border-width on every control, which is probably not what you really want (though it is what you were passing to set-document-properties). If so, you might want to call set-properties-everywhere for most of the options (because you really do want them everywhere), and set-document-properties for the few that you really only want to apply to the document.
Thank you so much Mr Mgordon for your excellent explanation which solved my problem.
Your replies are always helped us to explore Curl more and more.
