Controlling alignment of SAYs

Post Reply
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Controlling alignment of SAYs

Post by xProgrammer »

Hi Antonio (and fellow FiveLinuxers)

I have enhanced the TSay class so you can set the alignment of your SAYs.

In says.c:

Code: Select all

HB_FUNC( SAYSETALIGN )
{

   GtkWidget * hWnd = (GtkWidget * ) hb_parnl( 1 );
   
   gtk_misc_set_alignment( ( GtkMisc * ) hWnd, hb_parnd( 2 ), hb_parnd( 3 ) );
}
In say.prg:

Code: Select all

   METHOD SetAlignment( fHAlign, fVAlign ) INLINE SaySetAlign( ::hWnd, fHAlign, fVAlign )
And in your program code something like:

Code: Select all

@  30,  10 SAY sayKey VAR "Key" OF dlgPATIENT SIZE 90, 25 PIXEL
sayKey:SetAlignment( 0.0, 0.5 )
Next step is to include in #xcommand @ <row>, <col> SAY

By the way fHAlign is a float with 0.0 meaning left align, 1.0 meaning right align, fVAlign is a float with 0.0 meaning top align, 1.0 meaning bottom align. So the example above puts the label text at the left hand side centered vertically.

Happy to provide more information if required.

xProgrammer
Post Reply