Escaping the Font Selector window

This forum is meant for questions and discussions about the X# language and tools
User avatar
Irwin
Posts: 91
Joined: Wed Mar 23, 2022 10:24 am
Location: España

Escaping the Font Selector window

Post by Irwin »

Hi Chris,

If you click the Font property then it pop ups the Font selector window with the current control set font eg: "Segoe UI", 24.0 but if you press "Cancel" then the control takes "Microsoft Sans Serif, 8.25". It shouldn't change my current control font because I pressed "cancel".
User avatar
Chris
Posts: 5018
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Escaping the Font Selector window

Post by Chris »

Hi Irwin,

Pressing "Cancel" in this case is the way to set the property back to "Auto", so it does not set the font explicitly to something, it just let's windows decide. I know, this is not a good way of doing it, bun couldn't find a better way to specify "Auto" for font properties...
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Irwin
Posts: 91
Joined: Wed Mar 23, 2022 10:24 am
Location: España

Re: Escaping the Font Selector window

Post by Irwin »

Chris wrote: Fri Dec 27, 2024 12:50 pm Hi Irwin,

Pressing "Cancel" in this case is the way to set the property back to "Auto", so it does not set the font explicitly to something, it just let's windows decide. I know, this is not a good way of doing it, bun couldn't find a better way to specify "Auto" for font properties...
Hi Chris, no problem then. I'll get use to click "Accept" even when nothing has changed :-)
User avatar
Chris
Posts: 5018
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Escaping the Font Selector window

Post by Chris »

Hi Irwin,
Irwin wrote: Fri Dec 27, 2024 1:14 pm
Chris wrote: Fri Dec 27, 2024 12:50 pm Hi Irwin,

Pressing "Cancel" in this case is the way to set the property back to "Auto", so it does not set the font explicitly to something, it just let's windows decide. I know, this is not a good way of doing it, bun couldn't find a better way to specify "Auto" for font properties...
Hi Chris, no problem then. I'll get use to click "Accept" even when nothing has changed :-)
I was actually hoping you might have an idea on how to implement it in a better way :)
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Irwin
Posts: 91
Joined: Wed Mar 23, 2022 10:24 am
Location: España

Re: Escaping the Font Selector window

Post by Irwin »

Chris wrote: Fri Dec 27, 2024 1:20 pm Hi Irwin,
Irwin wrote: Fri Dec 27, 2024 1:14 pm
Chris wrote: Fri Dec 27, 2024 12:50 pm Hi Irwin,

Pressing "Cancel" in this case is the way to set the property back to "Auto", so it does not set the font explicitly to something, it just let's windows decide. I know, this is not a good way of doing it, bun couldn't find a better way to specify "Auto" for font properties...
Hi Chris, no problem then. I'll get use to click "Accept" even when nothing has changed :-)
I was actually hoping you might have an idea on how to implement it in a better way :)
Maybe you could save the current control (or controls) in a collection and if the user press "Cancel" set the old font settings to the selected controls but I don't know if that could be possible.
User avatar
Chris
Posts: 5018
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Escaping the Font Selector window

Post by Chris »

Hi Irwin,

I mean a different for the user way to select "Auto". Ideal would be to add an "Auto" button in the font selection dialog itself...Will give this some research to see if it is possible..
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
g.bunzel@domonet.de
Posts: 98
Joined: Tue Mar 01, 2016 11:50 am
Location: Germany

Re: Escaping the Font Selector window

Post by g.bunzel@domonet.de »

Hi Irwin,

do you check the Return-Value of the Show()-Method?


From the VO-Help:

StandardFontDialog:Show() Method


Purpose
Display a standard font dialog. To retrieve the value that the user selected, use the StandardFontDialog:Font access.


Syntax
<oStandardFontDialog>:Show() ---> LOGIC


Returns
TRUE if user chooses a font, FALSE if the user presses CANCEL.


...not checked....

HTH

Gerhard
User avatar
Chris
Posts: 5018
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Escaping the Font Selector window

Post by Chris »

Hi Gerhard,

This problem is an issue in how the form designer itself works in XIDE, there is currently no other way for the developer to explicitly set a font property to "Auto" while designing a window. So XIDE at the moment uses the action of closing/canceling the font dialog without pressing OK for setting the property to Auto. When he/she presses OK, then the new font is applied to the options.

Need to find a way for the user to specify 3 possible things, 1) Set the font property to the newly selected font, 2) Set it to <Auto>, 3) Cancel any change to the previously selected option.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
FFF
Posts: 1595
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Re: Escaping the Font Selector window

Post by FFF »

Chris,
possibly you could inject "<Auto>" to the fontlist?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
Chris
Posts: 5018
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Escaping the Font Selector window

Post by Chris »

Hi Karl,

Unfortunately I can't find a way to adjust anything in the controls of the FontDialog. Maybe only by using WinAPI direct calls to manipulate the dialog, but that's too risky as it can differently in various OS versions. Maybe it's just better to add a small clickable "A" button on the right hand side of the Properties window, when a font property is the selected one.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply