PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Where to put a Font variable
Where to put a Font variable
Iniciado por guest, 01,dic. 2015 16:56 - 3 respuestas
Publicado el 01,diciembre 2015 - 16:56
Would like to offer the user the ability to select his/her own font rather than the default. If it was a one time only event, easily done by using FontSelect():

gvDefaultFont is Font = FontCreate("Tahoma",10,iItalic) (global variable in project init)

UserFont is Font
Res = FontSelect(UserFont,True,DefaultFont)
IF Res THEN
BtnAdd..Font = UserFont
ELSE
BtnAdd..Font = gvDefaultFont
END

I would like to store the UserFont in a database field so we can reuse it... like this:

IF FileName.UserFont THEN
BtnAdd..Font = FileName.UserFont
ELSE
BtnAdd..Font = gvDefaultFont
END

Does anybody know what type of field to use (string, int, buffer... ?) and how to get the UserFont into that field?

Thanks, Art
Publicado el 01,diciembre 2015 - 17:13
you can store the individual properties of the font variable in your file:
FileName.UserFont_name=UserFont..name
FileName.UserFont_size=UserFont..size
...
...
...
http://doc.windev.com/en-US/…
Publicado el 02,diciembre 2015 - 05:25
Paulo, that was it! I was trying to take the easy way out and store the more complicated FONT variable, which did not work. Thanks for pointing that Help page out.

Thanks again, Art
Publicado el 02,diciembre 2015 - 09:21
Hi Art,

I guess you can store it in a memo field by using serialisation/deserialisation.
I haven't tested if it works on internal structures/classes from PCSoft.
It certainly works with custom build classes and structures.

Best regards,

Peter H.