TO ANTONIO : HELP TO CREATE A NEW CLASS

TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » Tue May 21, 2013 7:12 am

..
Last edited by Silvio.Falconi on Fri Apr 08, 2016 9:07 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Antonio Linares » Tue May 21, 2013 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » Tue May 21, 2013 9:07 am

Antonio,
I allready tried with brush and it made an error
Code: Select all  Expand view
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Antonio Linares » Tue May 21, 2013 9:42 am

Silvio,

Where "Verde" comes from ?

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

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

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Antonio Linares » Tue May 21, 2013 12:35 pm

Silvio,

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

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

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » Tue May 21, 2013 4: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » Tue May 21, 2013 5: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:nClrBack:=cColor,;
oLcd:refresh())


If I think this line have problem oLcd:nClrBack:=cColor,; because if I insert oLcd:nClrBack:= 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Antonio Linares » Tue May 21, 2013 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » Tue May 21, 2013 8: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Antonio Linares » Tue May 21, 2013 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » Tue May 21, 2013 9:36 pm

ooopppssssss
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: TO ANTONIO : HELP TO CREATE A NEW CLASS

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7016
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 50 guests