Folder & Font

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Folder & Font

Post by Otto »

In samples testfld4.prg from FWH I changed FONT in the rc-file everywhere to size 14.

But the dialogs still shown in a small font.

I tried:
AEVAL( oFolder:aDialogs, {|x| x:oFont := oFont} )

Then the label are shown in the fond of the folder but the controls like oGet are still in a small font.
How can I manage that all controls and label are shown in the same size and font as the folder?
Thanks in advance
Otto

Image
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

natter

Post by Natter »

oFolder:SetFont(font1)
oFolder:oFont2:=font2
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello Natter, thank you for your help. Now it is working.
Regards,
Otto
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Natter, do you know how to get the font which was used in the rc-file.

oFolder:SetFont(font1)
oFolder:oFont2:=font2

Reghards,
Otto
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

natter

Post by Natter »

what font ?
I not understand you question
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Natter, I mean the font I use in the resource file.
DLGTEST DIALOG 6, 15, 244, 155
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog de prueba - posibles bugs"
FONT 12, "MS Sans Serif"
{
LTEXT "Código :", -1, 9, 4, 38, 12
EDITTEXT 101, 41, 3, 52, 12
CONTROL FOLDER32, 102, FOLDER32, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 21, 236, 108
PUSHBUTTON "&Aceptar", 201, 153, 135, 40, 14
PUSHBUTTON "&Cancelar", 202, 197, 135, 40, 14
}


I tried your solution but I had to define a font.
Regards,
Otto
#include "fivewin.ch"

PROCEDURE main()
LOCAL oDlg, oFolder, font1
LOCAL cContrato:=space(13) ,;
cNombre:=space(30) ,;
cDireccion:=space(60) ,;
cTelefono:=space(10) ,;
cNotas:=""


DEFINE FONT font1 NAME "ARIAL" SIZE 0,-10 BOLD


//Define dialogo
DEFINE DIALOG oDlg NAME "DLGTEST";
TITLE "Another folder test"

//Redefine controles
REDEFINE GET cContrato;
ID 101 OF oDlg;
PICTURE "@!" ;
VALID !empty(cContrato)

//Redefine controles del dialogo
REDEFINE FOLDER oFolder ;
ID 102 ;
OF oDlg ;
PROMPTS "Pagina &1","Pagina &2" ;
DIALOGS "DlgPage1", "DlgPage2"



oDlg:SetFont(Font1)
AEVAL( oFolder:aDialogs, {|x| x:oFont := Font1} )
oFolder:SetFont(Font1)
oFolder:oFont2:=Font1


// oFolder:lWin95Look:=.f.

//Redefine controles del 1er. page
*=======================================================================
REDEFINE GET cNombre;
ID 101 OF oFolder:aDialogs[1];
PICTURE "@!" ;
VALID !empty(cNombre)

REDEFINE GET cDireccion;
ID 102 OF oFolder:aDialogs[1];
PICTURE "@!";
VALID !empty(cDireccion)

REDEFINE GET cTelefono;
ID 103 OF oFolder:aDialogs[1]

REDEFINE BTNBMP ;
ID 104 OF oFolder:aDialogs[1];
NAME "CANCELAR";
ACTION ( MsgDate() )

//Redefine controles del 2do. page
*=======================================================================
REDEFINE GET cNotas;
ID 101 OF oFolder:aDialogs[2];
MEMO

*=======================================================================
REDEFINE BUTTON;
ID 201 OF oDlg

REDEFINE BUTTON;
ID 202 OF oDlg;
ACTION oDlg:end() CANCEL

//Activar dialogo
ACTIVATE DIALOG oDlg CENTER ON INIT msginfo(oDlg:SetFont(Font1))


RETURN

procedure AppSys // Xbase++ requirement

return
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

natter

Post by Natter »

.....................................
ACTIVATE DIALOG oDlg CENTER ON INIT My_Init()

procedure My_Init
local fnt

fnt:=oDlg:aControls[1]:oFont && or oDlg:aControls[1]:GetFont()

....................................
return
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Thank you Natter,
Now I have the font in the My_Init function.
But how do I repaint/refresh all the controls?

Would you be so kind to help me on that, too?
Thanks in advance
Otto


procedure My_Init(oDlg,oFolder)
local fnt
local aPrompts :={"test1","test2"}

fnt := oDlg:GetFont()

msginfo(fnt:cFaceName())


//oDlg:SetFont(fnt)
//AEVAL( oFolder:aDialogs, {|x| x:oFont := fnt} )
//oFolder:SetFont(fnt)
//oFolder:oFont2 := fnt

return
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

natter

Post by Natter »

if I right understend

for st=1 to len(oDlg:aControls)
oDlg:aControls[st]:Refresh()
next
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Thank you Natter.

This iterates only through the
controls on the dialog not on the folder.
But I understand the system now.

I think it is easier to define the font in the program.

Thanks again for your help.
Regards,
Otto
Post Reply