Page 1 of 1

Set properties

Posted: Tue Aug 17, 2010 6:06 am
by Rathinagiri
Hi,

Today I had downloaded the new version from SVN.

The editbox.prg contains the following lines:

Code: Select all

	* Set Properties
	
	if ValType (::cValue)		!= 'U'	; Self:Value		:= ::cValue		; EndIf
	if ValType (::Row)		!= 'U'	; Self:Row		:= ::nRow		; EndIf
	if ValType (::Col)		!= 'U'	; Self:Col		:= ::nCol		; EndIf
	if ValType (::Width)		!= 'U'	; Self:Width		:= ::nWidth		; EndIf
	if ValType (::Height)		!= 'U'	; Self:Height		:= ::nHeight		; EndIf
	if ValType (::ScrollBars)	!= 'U'	; Self:ScrollBars	:= ::nScrollBars	; EndIf
	if ValType (::cFontName)	!= 'U'	; Self:FontName		:= ::cFontName 		; EndIf
	if ValType (::nFontSize)	!= 'U'	; Self:FontSize		:= ::nFontSize 		; EndIf
	if ValType (::lBold)		!= 'U'	; Self:FontBold		:= ::lBold 		; EndIf
	if ValType (::lItalic)		!= 'U'	; Self:FontItalic	:= ::lItalic 		; EndIf
	if ValType (::lUnderline)	!= 'U'	; Self:FontUnderline	:= ::lUnderline 	; EndIf
	if ValType (::lStrikeout)	!= 'U'	; Self:FontStrikeOut	:= ::lStrikeout 	; EndIf
	if ValType (::cToolTip)		!= 'U'	; Self:ToolTip		:= ::cToolTip		; EndIf	
	if ValType (::lReadOnly)	!= 'U'	; Self:ReadOnly		:= ::lReadOnly		; EndIf	
	if ValType (::lTabStop)		!= 'U'	; Self:TabStop		:= ::lTabStop		; EndIf	
	if ValType (::bOnGotFocus)	!= 'U'	; Self:OnGotFocus	:= ::bOnGotFocus	; endif
	if ValType (::bOnLostFocus)	!= 'U'	; Self:OnLostFocus	:= ::bOnLostFocus	; endif
I wish to extend this to checkbox control, on which I am working on.

And, please consider these lines

Code: Select all

	if ValType (::Row)		!= 'U'	; Self:Row		:= ::nRow		; EndIf
	if ValType (::cFontName)	!= 'U'	; Self:FontName		:= ::cFontName 		; EndIf
In the first line ::Row is verified for 'U' where as in the next line ::cFontName is verified. I want to know whether it is ::cFontName or ::FontName (like the previous line)

However, Self:Row and Self:FontName are the same for both the lines. Am I missing something here?! or I don't understand something basic?

Please help me out.

Re: Set properties

Posted: Tue Aug 17, 2010 6:41 am
by sudip
Hello Rathi,

In my very humble opinion it will be ::cFontName

May be I am wrong, but I think

::oObject:FontName

or

oObject:FontName

and

::cFontName

I don't know OOP very much. So, please correct me if I am wrong.

Re: Set properties

Posted: Tue Aug 17, 2010 6:47 am
by Rathinagiri
Now, there are two things inherited from the parent class (ie., control)

DATA are defined with the proper notation. (ie., adding c,n,l,a wherever necessary).

METHOD is defined with their name (like Value, Row, Col etc., to set/get the properties.

IMHO, these lines are someway or other, linking these data to these methods at the time of initialization.

I think Roberto can explain easily!

Re: Set properties

Posted: Tue Aug 17, 2010 12:46 pm
by Roberto Lopez
rathinagiri wrote: I wish to extend this to checkbox control, on which I am working on.

And, please consider these lines

Code: Select all

	if ValType (::Row)		!= 'U'	; Self:Row		:= ::nRow		; EndIf
	if ValType (::cFontName)	!= 'U'	; Self:FontName		:= ::cFontName 		; EndIf
In the first line ::Row is verified for 'U' where as in the next line ::cFontName is verified. I want to know whether it is ::cFontName or ::FontName (like the previous line)

However, Self:Row and Self:FontName are the same for both the lines. Am I missing something here?! or I don't understand something basic?

Please help me out.
Instead:

if ValType (::Row)

It must be:

if ValType (::nRow)

When the instance variable was initializated (!=Nil) we must to call the method required.

For ::nRow, the method is Self:Row.

Please, let me know if I've was clear enough (I've got a cold and I have fever, so maybe my explanation be not good as it should be:) )

Re: Set properties

Posted: Tue Aug 17, 2010 12:50 pm
by Roberto Lopez
rathinagiri wrote: I wish to extend this to checkbox control, on which I am working on.
Yes, of course.

Re: Set properties

Posted: Tue Aug 17, 2010 12:58 pm
by Rathinagiri
Thanks for the explanation Roberto.

So, that means, we have to change in the editbox.prg too!

Re: Set properties

Posted: Tue Aug 17, 2010 4:17 pm
by Roberto Lopez
rathinagiri wrote:Thanks for the explanation Roberto.

So, that means, we have to change in the editbox.prg too!
Yes... all other should be changed...