Text on a brush

Post Reply
User avatar
betoncu
Posts: 120
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Text on a brush

Post by betoncu »

I print a text on a brush in a main window.
But when I open a client window in the main window
it clears the text printed in the main window.
How can I get rid of this problem?

Many Thanks
Birol Betoncu
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Birol,

You have to paint it from the ON PAINT clause of the window:

ACTIVATE WINDOW oWnd ;
ON PAINT ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
betoncu
Posts: 120
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Post by betoncu »

Thanks Antonio. I will try.
User avatar
betoncu
Posts: 120
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Post by betoncu »

Antonio,
If I use a dialog it is OK.
But when I use a window the text overlays the client window.
Any Suggestions?

Many Thanks,
Birol
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Birol,

> But when I use a window the text overlays the client window.

Please post an image of it, or a sample to reproduce it. You may store an image at www.imageshack.us and copy here the provided url.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
betoncu
Posts: 120
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Post by betoncu »

Antonio,
I have attached a reduced code to show my problem.

Thanks & Regards
Birol

Code: Select all

#include "FiveWin.ch"
#include "xbrowse.ch"

static oWndMain

function Main()
local oBrush,oFont

   DEFINE BRUSH oBrush COLOR nRGB( 12, 129, 87 )

   DEFINE WINDOW oWndMain ;
      BRUSH oBrush ;
      MDI ;
      MENU BuildMenu()

   ACTIVATE WINDOW oWndMain MAXIMIZED ON PAINT PaintRtn()
return nil

STATIC FUNCTION PaintRtn()
LOCAL oFont,cYear:='2006'
   DEFINE FONT oFont NAME "ARIAL" SIZE 100, -180
   @ 15,40 SAY cYear OF oWndMain FONT oFont ;
           COLOR CLR_YELLOW, nRGB( 12, 129, 87 ) ;
           SIZE 500,200
   oFont:End()
RETURN NIL

STATIC FUNCTION BuildMenu()
LOCAL oMenu
   MENU oMenu
      MENUITEM "Test"
      MENU
         MENUITEM "Test" ACTION TestRtn(oWndMain)
      ENDMENU
   ENDMENU
return oMenu

STATIC FUNCTION TestRtn(oWnd)
local oChild, oBrw, aArray:={}

   AADD(aArray,{'aaaa','aaaaaaaaaaaaaa','aaaaaaaaaaaaaa','aaaaaaaaaaaa'})

   DEFINE WINDOW oChild ;
      FROM 0, 0 TO 500,400 ;
      MDICHILD ;
      PIXEL ;
      OF oWnd

   oBrw := TXBrowse():New( oChild )

   oBrw:SetArray( aArray)

   oBrw:aCols[1]:cHeader := "Head-1"
   oBrw:aCols[2]:cHeader := "Head-2"
   oBrw:aCols[3]:cHeader := "Head-3"
   oBrw:aCols[4]:cHeader := "Head-4"

   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLCELL
   oBrw:lRecordSelector := .f.

   oBrw:CreateFromCode()

   oChild:SetControl(oBrw)

   ACTIVATE WINDOW oChild ON INIT oBrw:SetFocus()
RETURN NIL
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Birol,

Modify this function this way:

Code: Select all

STATIC FUNCTION PaintRtn() 
LOCAL oFont,cYear:='2006' 
   DEFINE FONT oFont NAME "ARIAL" SIZE 100, -180
   oWndMain:oWndClient:Say( 15, 40, cYear, CLR_YELLOW, nRGB( 12, 129, 87 ), oFont )  
   oFont:End() 
RETURN NIL 
Remember that a MDI environment uses a "ghost" child window (oWndClient). Its explained in FW documentation :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
betoncu
Posts: 120
Joined: Sat Oct 08, 2005 9:38 pm
Location: Cyprus (North)

Post by betoncu »

Antonio,
It works perfectly.
Thank you very much.

Birol :D
Post Reply