BtnBmp : Text Alignments

BtnBmp : Text Alignments

Postby nageswaragunupudi » Mon May 16, 2016 3:28 pm

We know that by using the clause LEFT/RIGHT/TOP/BOTTOM while creating a bitmap, the prompt is aligned opposite to the bitmap.

Now there is a way to make finer adjustments in the alignment of text, right/center/left by adding a space on left,right or both sides of the prompt

Image

"Prompt" --> Default alignment
"Prompt " --> Left Alignment
" Prompt" --> Right Alignment
" Prompt " --> Center (horizontally) Alignment.

Following sample, demonstrates the usage.
Code: Select all  Expand view
function BtnText1()

   local oDlg, oBtn, oFont

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-16

   DEFINE DIALOG oDlg SIZE 460,460 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "BTNBMP TEXT ALIGNMENTS"

   @  20,20 BTNBMP oBtn FILE "..\bitmaps\32x32\task.bmp" ;
      PROMPT "Default" + CRLF + "Alignment" LEFT ;
      SIZE 200,60 PIXEL OF oDlg 2007

   @ 100,20 BTNBMP oBtn FILE "..\bitmaps\32x32\copy.bmp" ;
      PROMPT "Left" + CRLF + "Alignment " LEFT ;
      SIZE 200,60 PIXEL OF oDlg 2007

   @ 180,20 BTNBMP oBtn FILE "..\bitmaps\32x32\paste.bmp" ;
      PROMPT " Center" + CRLF + "Alignment " LEFT ;
      SIZE 200,60 PIXEL OF oDlg 2007

   @  20,240 BTNBMP oBtn FILE "..\bitmaps\32x32\task.bmp" ;
      PROMPT "Default" + CRLF + "Alignment" RIGHT ;
      SIZE 200,60 PIXEL OF oDlg 2007

   @ 100,240 BTNBMP oBtn FILE "..\bitmaps\32x32\copy.bmp" ;
      PROMPT " Right" + CRLF + "Alignment" RIGHT ;
      SIZE 200,60 PIXEL OF oDlg 2007

   @ 180,240 BTNBMP oBtn FILE "..\bitmaps\32x32\paste.bmp" ;
      PROMPT " Center" + CRLF + "Alignment " RIGHT ;
      SIZE 200,60 PIXEL OF oDlg 2007

   @ 260, 20 BTNBMP oBtn FILE "..\bitmaps\32x32\task.bmp" ;
      PROMPT "Left " TOP ;
      SIZE 128,80 PIXEL OF oDlg 2007

   @ 260,165 BTNBMP oBtn FILE "..\bitmaps\32x32\copy.bmp" ;
      PROMPT "Default" TOP ;
      SIZE 128,80 PIXEL OF oDlg 2007

   @ 260,312 BTNBMP oBtn FILE "..\bitmaps\32x32\paste.bmp" ;
      PROMPT " Right" TOP ;
      SIZE 128,80 PIXEL OF oDlg 2007

   @ 360, 20 BTNBMP oBtn FILE "..\bitmaps\32x32\task.bmp" ;
      PROMPT "Left " BOTTOM ;
      SIZE 128,80 PIXEL OF oDlg 2007

   @ 360,165 BTNBMP oBtn FILE "..\bitmaps\32x32\copy.bmp" ;
      PROMPT "Default" BOTTOM ;
      SIZE 128,80 PIXEL OF oDlg 2007

   @ 360,312 BTNBMP oBtn FILE "..\bitmaps\32x32\paste.bmp" ;
      PROMPT " Right" BOTTOM ;
      SIZE 128,80 PIXEL OF oDlg 2007

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10283
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: BtnBmp : Text Alignments

Postby TimStone » Mon May 16, 2016 4:28 pm

I have been doing that for columns in xbrowse. Otherwise the column line may sit right next to the first letter making it difficult to read. It's easy to do and makes the appearance better.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2905
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: BtnBmp : Text Alignments

Postby nageswaragunupudi » Mon May 16, 2016 4:38 pm

TimStone wrote:I have been doing that for columns in xbrowse. Otherwise the column line may sit right next to the first letter making it difficult to read. It's easy to do and makes the appearance better.

Do you mean to say that the default margin we provide is not enough? Do you suggest we provide more margin on the left?
If you can please explain we see how we can provide a better and clearer presentation by default
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10283
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: BtnBmp : Text Alignments

Postby TimStone » Mon May 16, 2016 4:51 pm

When we allow the columns to autosize, I found sometimes they would be tight on the headers and the first and/or last letters would not display cleanly.

So I added a space before and after each header, and it all worked perfectly.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2905
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 29 guests