Page 1 of 1

Text on a brush

Posted: Thu Jun 29, 2006 3:48 am
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

Posted: Thu Jun 29, 2006 5:24 am
by Antonio Linares
Birol,

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

ACTIVATE WINDOW oWnd ;
ON PAINT ...

Posted: Fri Jun 30, 2006 5:30 pm
by betoncu
Thanks Antonio. I will try.

Posted: Sun Jul 02, 2006 6:54 pm
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

Posted: Sun Jul 02, 2006 8:34 pm
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.

Posted: Mon Jul 03, 2006 12:52 am
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

Posted: Mon Jul 03, 2006 4:48 am
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 :)

Posted: Mon Jul 03, 2006 2:59 pm
by betoncu
Antonio,
It works perfectly.
Thank you very much.

Birol :D