FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TO ANTONIO : HELP TO CREATE A NEW CLASS
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 07:12 AM

..

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 08:40 AM
Silvio,

FillRect() expects a HBRUSH not a RGB color:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd162719(v=vs.85).aspx

DEFINE BRUSH oBrush COLOR ...

FillRect( ::hDC, aRect, oBrush:hBrush )

...

oBrush:End()
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 09:07 AM
Antonio,
I allready tried with brush and it made an error
Code (fw): Select all Collapse
Application
===========
   Path and name: C:\work\errori\tled\test.Exe (32 bits)
   Size: 1,892,864 bytes
   Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6715)
   FiveWin  Version: FWHX 13.01
   Windows version: 5.1, Build 2600 Service Pack 2

   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 05/21/13, 11:08:29
   Error description: Error BASE/1070  Argument error: ==
   Args:
     [   1] = C   Verde
     [   2] = N   16777215

Stack Calls
===========
   Called from: .\source\classes\BRUSH.PRG => TBRUSH:NEW( 132 )
   Called from: test.prg => TLED:PAINT( 171 )
   Called from: test.prg => (b)TLED:TLED( 78 )
   Called from:  => TLED:DISPLAY( 0 )
   Called from: .\source\classes\CONTROL.PRG => TLED:HANDLEEVENT( 1690 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3177 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
   Called from: test.prg => TEST( 59 )










the paint method

METHOD Paint CLASS TLED
local hDC := ::hDC

LOCAL aRect := GetClientRect(hDC)
LOCAL nClPixel, aLinea, aCarattere, cFila

LOCAL nI, nJ, nAltezza, nLarghezza
LOCAL y := 0
LOCAL x := 0
LOCAL cTmp
local oBrush
local aInfo := ::DispBegin()

DEFINE BRUSH oBrush COLOR ::nClrBack

FillRect( ::hDC, aRect, oBrush:hBrush )


if ::bPainted != nil
Eval( ::bPainted, ::hDC, self )
endif

oBrush:End()
::DispEnd( aInfo )

return 0
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 09:42 AM

Silvio,

Where "Verde" comes from ?

 [   1] = C   Verde
 [   2] = N   16777215
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 10:26 AM

come from comboBox :
Local aColors:={"CLR_BLACK","CLR_BLUE" ,"CLR_GREEN", "CLR_CYAN" , ;
"CLR_RED" ,"CLR_MAGENTA","CLR_GRAY","CLR_HBLUE", ;
"CLR_HGREEN","CLR_HCYAN","CLR_HRED" ,"CLR_HMAGENTA", ;
"CLR_YELLOW","CLR_WHITE","CLR_HGRAY"}

Local aClr:={"Nero","Azurro","Verde","Cielo","Rosso","Magenta",       ;
               "Grigio","Azurro Intenso","Verde Intenso","Cielo Intenso", ;
               "Rosso Intenso","Magenta Intenso","Amarillo","Bianco" ,"Grigio chiaro" }

@ 64, 50 combobox aGet[1] VAR nBackColor ITEMS aClr of oDlg Size 40,60 PIXEL ;
ON CHANGE(nColore:= aColors[VAL(ltrim(STR(AScan( aclr, Trim(nBackColor))))) ],;
nmsgbox(nColore),oLcd:nClrBack:=nColore,oLcd:refresh())

Isent you a test.prg

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 10:41 AM

If you make also :

oLcd := TLed():New(10,5,oDlg)
oLcd:nClrBack:= CLR_RED

not show the Red color But Black

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 12:35 PM

Silvio,

GetClientRect() parameter is ::hWnd, not ::hDC

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 04:51 PM

Yes sorry but not refresh() the same
at init give me the object on red color then when I change color it return black

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 05:31 PM
Antonio,

the error is on on change when I select a color and it not save on variable the right color

@ 66, 8 SAY "Sfondo :" SIZE 69, 8 PIXEL OF oDlg

@ 64, 50 combobox aGet[1] VAR nBackColor ITEMS aClr of oDlg Size 40,60 PIXEL ;
ON CHANGE(nmsgbox(nBackColor),;
cColor:=aColors[nBackColor],;
nmsgbox(cColor) ,;
oLcd:=cColor,;
oLcd:refresh())


If I think this line have problem oLcd:=cColor,; because if I insert oLcd:= CLR_GREEN RUN OK

THE CHANGE NOT TRANSLATE THE ARRAY INTO CLR_XXXXX
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 08:47 PM

Is cColor a string ? As you use "c" in front of it, looks like you store a string there, and you have to provide a number (RGB).

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 08:55 PM

Antonio,
I wish make a combobox with a selection of colors we have on colors.ch
this combox must give us a the string of color to assign to oLcd:nclrBack to refresh the background of the object
Could help me please ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 08:59 PM

Silvio,

Local aColors:={CLR_BLACK,CLR_BLUE ,CLR_GREEN, CLR_CYAN , ;
CLR_RED ,CLR_MAGENTA,CLR_GRAY,CLR_HBLUE, ;
CLR_HGREEN,CLR_HCYAN,CLR_HRED ,CLR_HMAGENTA, ;
CLR_YELLOW,CLR_WHITE,CLR_HGRAY}

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 09:36 PM

ooopppssssss

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: TO ANTONIO : HELP TO CREATE A NEW CLASS
Posted: Tue May 21, 2013 10:50 PM

OK..RESOLVED

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion