Page 11 of 16

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 1:55 pm
by Roberto Lopez
mol wrote:
Roberto Lopez wrote:Excepting for NtoC, it is working nicely.

I have only one objection: If the user do not specify a color, we should leave to QT to use the default colors for the control.

So, if a color == NIl we should do nothing for it.
Of course, I've set it for testing only.

NtoC was copied from harbour distribution. I can work on another conversion method. What do you think?
I'll try to find a way for that hbmk2 pick it from its library... I'll keep you posted.

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 2:10 pm
by Roberto Lopez
mol wrote:Code changing colors should look like:

Code: Select all

if ValType(::aFontColor) == 'U'
		xForeColor := '#000000;'
	else
		xForeColor := '#'+NtoC(aFontColor[1],16,2)+NtoC(aFontColor[2],16,2)+NtoC(aFontColor[3],16,2)+';'
	endif
	cStyleSheet += 'color:'+xForeColor + ';'
	if ValType(::aBackColor) == 'A'
		cStyleSheet += 'background-color:#'+NtoC(aBackColor[1],16,2)+NtoC(aBackColor[2],16,2)+NtoC(aBackColor[3],16,2)+';'
	endif
	
	if !empty(cStyleSheet)
		::oQTObject:setStyleSheet(cStyleSheet)
	endif
but, while compiling, I get an error about not found function NTOC
I need simple conversion from numbers to hex to paste color in #RRGGBB format.
You must add -lhbct to your HBMK2 line in build.bat

HBMK2 %1 -Lc:\HMG.4\qt\lib -lhbct

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 2:19 pm
by Roberto Lopez
Roberto Lopez wrote: You must add -lhbct to your HBMK2 line in build.bat

HBMK2 %1 -Lc:\HMG.4\qt\lib -lhbct
The library is correctly linked, but apparently there is a problem with your code.

I've got working typing the color directly (ie: #00ff00 for green).

Appears to be that the color string is not correctly built.

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 2:21 pm
by esgici
Roberto Lopez wrote: ... so I'll encourage you a little more :)
Thanks a lot :)

Now I understand better object - class relationship.
Roberto Lopez wrote: To be continued...
I'll wait eagerly.

Best regards

--

Esgici

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 2:33 pm
by sudip
Hello Esgici,

I am also learning with you :)

Thank you and Roberto :)

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 3:13 pm
by Roberto Lopez
esgici wrote: I'll wait eagerly.
Well...

oButton := Button:Create()

'Create' in OOP slang is a 'method' but, just between us, you can think about it just like a function (or procedure).

The advantage of a method is that it is 'inside' a class, so...

Button:Create()

is different that

TextBox:Create()

You are invoking methods (procedures) called the same but they are different ones, coded in different classes.

One of the big things about OOP is inheritance.

All control classes are defined to 'inherit' from control class.

This is written as follows (ie: button class):

CLASS BUTTON FROM CONTROL

Meaning that button control can use properties event and methods defined in control class.

So, you must code (ie) Row property once and it is automatically available for all other controls.

You must write new code only for controls that need a special treatment for the same property, event or method.

Really nice... :)

As I've said, it looks hard at the beginning, but it can be extremely useful when you are handling a complex situation...

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 3:25 pm
by Rathinagiri
Yes, Roberto.

It is only a starting trouble. :)

Now, shall I start working on another control or the missing common properties of checkbox?

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 4:14 pm
by Roberto Lopez
rathinagiri wrote:Yes, Roberto.

It is only a starting trouble. :)

Now, shall I start working on another control or the missing common properties of checkbox?
IMHO, the best way to go is that we finish 'our' controls before to start working in another one, but coordinating the work to not overlap us in the case of shared properties (located at Control class).

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 4:30 pm
by Rathinagiri
Yes. So, shall I co-ordinate with the shared properties?

I think color is taken by Marek. The only property unattended in checkbox which is common is transparent. Shall I take that one and try on?

Re: HMG 4 Started

Posted: Tue Aug 17, 2010 6:11 pm
by esgici
Roberto Lopez wrote: Really nice... :)
As I've said, it looks hard at the beginning, but it can be extremely useful when you are handling a complex situation...
Thanks, please continue :D

Best regards

--

Esgici