Set properties

Moderator: Rathinagiri

Post Reply
User avatar
Rathinagiri
Posts: 5166
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 129 times
Been thanked: 131 times
Contact:

Set properties

Post by Rathinagiri » Tue Aug 17, 2010 6:06 am

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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
sudip
Posts: 1444
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 4 times

Post by sudip » Tue Aug 17, 2010 6:41 am

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.
With best regards,
Sudip

User avatar
Rathinagiri
Posts: 5166
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 129 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Tue Aug 17, 2010 6:47 am

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!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Roberto Lopez
HMG Founder
Posts: 3899
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 135 times

Post by Roberto Lopez » Tue Aug 17, 2010 12:46 pm

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:) )
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3899
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 135 times

Post by Roberto Lopez » Tue Aug 17, 2010 12:50 pm

rathinagiri wrote: I wish to extend this to checkbox control, on which I am working on.
Yes, of course.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Rathinagiri
Posts: 5166
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 129 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Tue Aug 17, 2010 12:58 pm

Thanks for the explanation Roberto.

So, that means, we have to change in the editbox.prg too!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Roberto Lopez
HMG Founder
Posts: 3899
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 135 times

Post by Roberto Lopez » Tue Aug 17, 2010 4:17 pm

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...
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

Post Reply