Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #3095

Center Text Vertically in a SingleLineEdit Control

From David Foley <davidmpfoley@gmail.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Center Text Vertically in a SingleLineEdit Control
Date 2012-03-07 06:38 -0800
Organization http://groups.google.com
Message-ID <2246992.7806.1331131102208.JavaMail.geo-discussion-forums@ynlw24> (permalink)

Show all headers | View raw


HI All
Wondering if someone might be able to help me. I am testing some code which I was hoping would help me in centering text VERTICALLY in a SingleLineEdit control. It does not seem to be working for me. Hoping someone might be able to point out where I am going wrong or if this will work at all. To implement the test I created a new Standard SDI Application. I then amended the HelpAbout screen to extend its size and add a new SingleLineEdit control which is set to ReadOnly. I then Replaced the HelpAbout:PosInit() method with the following code.
Thanks in Advance for any help
David Foley


METHOD PostInit(oParent,uExtra) CLASS HelpAbout
	LOCAL sVer AS STRING
	LOCAL oSysLink AS SysLink
	LOCAL oFT1, oFT2 AS FixedText
	LOCAL oHL1, oHL2 AS HyperLink
	LOCAL oFont1, oFont2 AS Font
	LOCAL s AS STRING        
	
////////////////////////////////////////////////
// *** CODE ADDED IN - START ***** /////////////
////////////////////////////////////////////////

LOCAL sRect IS _winRect 		// DF#010312	
LOCAL hDC AS PTR
LOCAL cText AS STRING

cText := "This is a test"


	GetClientRect(SELF:oDCSingleLineEdit1:Handle(0), @sRect)

	// Get Controls Device Context 
	hDC := GetDC(SELF:oDCSingleLineEdit1:Handle(0))  
	
    DrawText(hDC, Cast2Psz(cText), INT(SLen(cText)), @sRect,DT_CENTER+DT_VCENTER+DT_SINGLELINE )    
    
    ReleaseDC(SELF:oDCSingleLineEdit1:Handle(0),hDC)

////////////////////////////////////////////////
// *** CODE ADDED IN - END ***** ///////////////
////////////////////////////////////////////////
	

	sVer := Version()
	sVer := SubStr(sVer, RAt2(" ", sVer)+1)
	oDCAboutText:CurrentText := _CHR(13)+" Visual Objects Standard Application"+_CHR(13)+_CHR(13);
		+" Version "+sVer+_CHR(13)+_CHR(13);
		+" © 1994-2008 GrafX Software Dev. Inc.& CA Int"
		
	IF IsThemeEnabled()
		s := "Visit <A HREF="+_CHR(34)+;
			"http://www.grafxsoft.com"+_CHR(34)+">GrafX</A> and <A HREF="+_CHR(34)+;
			"http://www.cavo.com"+_CHR(34)+">Visual Objects</A> on the web!"
		oSysLink := SysLink{SELF, -1, Point{10,5}, Dimension{300,20}, s}
		oSysLink:Show()
	ELSE
		
		s := "Visit GrafX on the web:"
		oFT1 := FixedText{SELF, -1, Point{10,25}, dimension{200,20}, s}
		oFT1:show()

		s := "Visit Visual Objects on the web:"
		oFT2 := FixedText{SELF, -1, Point{10,5}, dimension{200,20}, s}
		oFT2:show()
		
		oFont1 := Font{,8,"Microsoft Sans Serif"}
		oFont1:Underline := TRUE
		
		oHL1 := HyperLink{SELF,-1,point{190,25},dimension{0,0},"http://www.grafxsoft.com"}
		oHL1:controlfont := oFont1
		oHL1:size := dimension{150,20}
		oHL1:textcolor := color{COLORBLUE}
		oHL1:controlfont:Underline := TRUE
		oHL1:show()

		oFont2 := Font{,8,"Microsoft Sans Serif"}
		oFont2:Underline := TRUE

		oHL2 := HyperLink{SELF,-1,point{190,5},dimension{0,0},"http://www.cavo.com"}
		oHL2:controlfont := oFont2
		oHL2:size := dimension{150,20}
		oHL2:textcolor := color{COLORBLUE}
		oHL2:controlfont:Underline := TRUE
		oHL2:show()
		
	ENDIF


	RETURN NIL

Back to comp.lang.clipper.visual-objects | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Center Text Vertically in a SingleLineEdit Control David Foley <davidmpfoley@gmail.com> - 2012-03-07 06:38 -0800
  Re: Center Text Vertically in a SingleLineEdit Control John Martens <adsl672100@tiscali.nl> - 2012-03-07 17:30 +0100
    Re: Center Text Vertically in a SingleLineEdit Control David Foley <davidmpfoley@gmail.com> - 2012-03-07 14:50 -0800
      Re: Center Text Vertically in a SingleLineEdit Control John Martens <adsl672100@tiscali.nl> - 2012-03-08 07:35 +0100
        Re: Center Text Vertically in a SingleLineEdit Control David Foley <davidmpfoley@gmail.com> - 2012-03-08 00:56 -0800

csiph-web