Adding support for PIXEL clause

Adding support for PIXEL clause

Postby xProgrammer » Mon Apr 21, 2008 12:04 pm

This is easy to do. I'll use the TSay Class as an example.

You need to modify FiveLinux.ch (better still copy to FiveLinuxME.ch) and change as follows:

Code: Select all  Expand view
#xcommand @ <nRow>, <nCol> SAY [ <oSay> <label: PROMPT, VAR> ] <cText> ;
                        [ <of: OF, WINDOW, DIALOG> <oWnd> ] ;
         [ SIZE <nWidth>, <nHeight> ] ;
         [ <update: UPDATE> ] ;
                        [ <pixel: PIXEL> ] ;
         => ;
                        [ <oSay> := ] TSay():New( <nRow>, <nCol>, [<oWnd>],;
         <cText>, <nWidth>, <nHeight>, <.update.>, <.pixel.> )


and modify get.prg as follows:

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

CLASS TSay FROM TControl

   METHOD New( nRow, nCol, oWnd, cText, nWidth, nHeight, lUpdate )

   METHOD SetText( cText ) INLINE SaySetText( ::hWnd, cText )

   METHOD GetText() INLINE SayGetText( ::hWnd )

ENDCLASS

METHOD New( nRow, nCol, oWnd, cText, nWidth, nHeight, lUpdate, lPixel ) CLASS TSay

   DEFAULT oWnd := GetWndDefault(), nWidth := 60, nHeight := 25,;
           lUpdate := .f., lPixel := .F.

   ::hWnd = CreateSay( cText )
   ::lUpdate = lUpdate

   oWnd:AddControl( Self )

   SetParent( ::hWnd, oWnd:hWnd )
   IF lPixel
      SetCoors( ::hWnd, nRow, nCol )
     ELSE
      SetCoors( ::hWnd, nRow * 10, nCol * 10 )
   ENDIF
   SetSize( ::hWnd, nWidth, nHeight )

   ::Link()

return Self


Method New has an additional parameter (lPixel) which if set just avoids multiplying nRow and nCol by 10 (which is how FiveLinux "simulates" rows and columns). I was tempted make this the default behaviour, but in the end decided that it was probably best to stay compatible with FiveWin.

Happy tinkering!

xProgrammer
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Antonio Linares » Mon Apr 21, 2008 3:45 pm

Doug,

It seems that somehow you are not using the latest FiveLinux files as the PIXEL clause is already available since long time ago.

Please contact me by email to synchronize our sources, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41208
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveLinux / FiveDroid (Android)

Who is online

Users browsing this forum: No registered users and 7 guests