Display the text vertically

Display the text vertically

Postby Natter » Thu Dec 03, 2015 8:36 am

Hello !

Is it possible in the cell of xBrowse to display the text vertically ?
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Display the text vertically

Postby nageswaragunupudi » Thu Dec 03, 2015 1:02 pm

Image

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oWnd, oFont, oVert, oBrw
   local aData := { { "One", "Five Win" }, { "Two", "Hello World" }}

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
   DEFINE FONT oVert NAME "TAHOMA" SIZE 0,-12 NESCAPEMENT 900

   DEFINE WINDOW oWnd
   oWnd:SetFont( oFont )

   @ 0,0 XBROWSE oBrw OF oWnd DATASOURCE aData AUTOCOLS ;
      HEADERS "First", "Second" ;
      LINES NOBORDER

   WITH OBJECT oBrw:aCols[ 1 ]
      :oHeaderFont   := oVert
      :oDataFont     := oVert
   END
   oBrw:nRowHeight   := 100

   oBrw:CreateFromCode()
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE FONT oFont, oVert

return nil
 

I have to agree, the vertical alignment of the text in the cells is not correct.
We need to improve this.

Please also let us know the version of FWH you are using.
Regards

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

Re: Display the text vertically

Postby horacio » Thu Dec 03, 2015 1:24 pm

I think it does not take vertical text alignment. In the header and data . It is possible to do so ?
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Display the text vertically

Postby nageswaragunupudi » Thu Dec 03, 2015 1:27 pm

horacio wrote:I think it does not take vertical text alignment. In the header and data . It is possible to do so ?

As I said, we need to do some improvements and we shall do.
But basically it is possible and easy to paint vertical text in headers and cells.
Regards

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

Re: Display the text vertically

Postby horacio » Thu Dec 03, 2015 2:14 pm

Sorry , I had not fully read the post .

Saludos
horacio
 
Posts: 1363
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Display the text vertically

Postby Natter » Thu Dec 03, 2015 8:42 pm

Thank, Mr. Rao

FWH1507/BCC7/xHarbour
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Display the text vertically

Postby nageswaragunupudi » Fri Dec 04, 2015 2:14 am

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oWnd, oFont, oVert, oBrw
   local aData := { { "One", "Five Win" }, { "Two", "Hello World" }}

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
   DEFINE FONT oVert NAME "TAHOMA" SIZE 0,-12 NESCAPEMENT 900

   DEFINE WINDOW oWnd
   oWnd:SetFont( oFont )

   @ 0,0 XBROWSE oBrw OF oWnd DATASOURCE aData AUTOCOLS ;
      HEADERS "First", "Second" ;
      LINES NOBORDER

   WITH OBJECT oBrw:aCols[ 1 ]
      :oHeaderFont   := oVert
      :oDataFont     := oVert
      :bPaintText    := { | oCol, hDC, cData, aRect, aColors, lHighLite, lSelected | ;
                          PaintText( oCol, hDC, cData, aRect, aColors, lHighLite, lSelected ) }
   END
   oBrw:nRowHeight   := 80

   oBrw:CreateFromCode()
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE FONT oFont, oVert

return nil

#define DT_CENTER                   0x00000001

func PaintText( Self, hDC, cData, aRect, aColors, lHighLite, lSelected )

   local nTextWidth     := ::oBrw:GetWidth( cData, ::oDataFont )
   local nBottom

   nBottom  := aRect[ 3 ] - ( aRect[ 3 ] - aRect[ 1 ] - nTextWidth ) / 2
   DrawTextEx( hDC, cData, { nBottom, aRect[ 2 ], aRect[ 1 ], aRect[ 4 ] }, DT_CENTER )

return nil
 


Image
Regards

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

Re: Display the text vertically

Postby nageswaragunupudi » Fri Dec 04, 2015 6:23 am

FWH15.10 now paints vertical text in cells honoring the nDataStrAlign.
Regards

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

Re: Display the text vertically

Postby Natter » Fri Dec 04, 2015 7:06 am

This is what we need. Thank, Mr. Rao !

Is it possible in XBrowse horizontal merging of cells (a la Excel) ?
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: Display the text vertically

Postby nageswaragunupudi » Fri Dec 04, 2015 7:23 am

Natter wrote:Is it possible in XBrowse horizontal merging of cells (a la Excel) ?


No
Only vertical merging.
Regards

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

Re: Display the text vertically

Postby mariordz » Thu Sep 10, 2020 2:08 pm

Good mornign Mr. Rao, I know this is an old post, but when trying to use it I get the next error:
Code: Select all  Expand view
Application
===========
   Path and name: C:\xDevStudio\Projects\Tubelite\Tubelite.EXE (32 bits)
   Size: 9,551,360 bytes
   Compiler version: Harbour 3.2.0dev (r1603082110)
   FiveWin  version: FWH 19.12
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 5 secs
   Error occurred at: 10/09/2020, 09:06:37
   Error description: Error BASE/1003  No existe la variable: OVERT

Stack Calls
===========
   Called from: C:\xDevStudio\Projects\Tubelite\Source\Tubelite.prg => DIRECTORIO( 6915 )
   Called from: C:\xDevStudio\Projects\Tubelite\Source\Tubelite.prg => (b)DEFINE_RIBBON( 1558 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:CLICK( 717 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:LBUTTONUP( 917 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1791 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:HANDLEEVENT( 1575 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1097 )
   Called from: C:\xDevStudio\Projects\Tubelite\Source\Tubelite.prg => MAIN( 494 )
 


this is teh part on the code:

Code: Select all  Expand view
    WITH OBJECT oBrw:aCols[ 1 ]
        :oDataFont     := oVert
        :bPaintText    := { | oCol, hDC, cData, aRect, aColors, lHighLite, lSelected | ;
                          PaintText( oCol, hDC, cData, aRect, aColors, lHighLite, lSelected ) }
    END
User avatar
mariordz
 
Posts: 131
Joined: Tue Dec 26, 2006 4:50 pm
Location: Ciudad de México

Re: Display the text vertically

Postby nageswaragunupudi » Thu Sep 10, 2020 4:06 pm

The above program compiles and executes perfectly here.
Please check if you copied the program correctly.
Regards

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

Re: Display the text vertically

Postby nageswaragunupudi » Thu Sep 10, 2020 4:10 pm

This was the proposed program for very old versions.
For all recent versions, this is extremely simple.

Simple assignment of vertical font is enough.

This sample works.

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oWnd, oFont, oVert, oBrw
   local aData := { { "One", "Five Win" }, { "Two", "Hello World" }}

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
   DEFINE FONT oVert NAME "TAHOMA" SIZE 0,-12 NESCAPEMENT 900

   DEFINE WINDOW oWnd
   oWnd:SetFont( oFont )

   @ 0,0 XBROWSE oBrw OF oWnd DATASOURCE aData AUTOCOLS ;
      HEADERS "First", "Second" ;
      LINES NOBORDER

   WITH OBJECT oBrw:aCols[ 1 ]
      :oHeaderFont   := oVert
      :oDataFont     := oVert
   END
   oBrw:nRowHeight   := 80

   oBrw:CreateFromCode()
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE FONT oFont, oVert

return nil
   
 
Regards

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

Re: Display the text vertically

Postby mariordz » Thu Sep 10, 2020 4:42 pm

You are totally right Mr. Rao, I failed to expalin correctly what I wanted.
The first column of my xbrowse has the branch the employees are assigned to, and i have it merged, what I really wanted to achieve was to show the text in vertical orientation in to the merged cells, and the example you provide shows the vertical text in one row only.

I hope this can be achieved, only for aesthetic reasons
Image
User avatar
mariordz
 
Posts: 131
Joined: Tue Dec 26, 2006 4:50 pm
Location: Ciudad de México

Re: Display the text vertically

Postby Marc Venken » Thu Sep 10, 2020 9:00 pm

mariordz wrote:You are totally right Mr. Rao, I failed to expalin correctly what I wanted.
The first column of my xbrowse has the branch the employees are assigned to, and i have it merged, what I really wanted to achieve was to show the text in vertical orientation in to the merged cells, and the example you provide shows the vertical text in one row only.

I hope this can be achieved, only for aesthetic reasons
Image


If you use CRLF (Line Feed) then I think you got what you need.

From Mr. Rao's sample (above)

local aData := { { "One"+CRLF+"TWO", "Five Win" }, { "Two"+CRLF+"DRIE", "Hello World" }}
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1429
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 45 guests