Page 5 of 16

Re: HMG 4 Started

Posted: Sat Aug 14, 2010 5:48 pm
by sudip
Ok Roberto.

I shall continue with spinner.

I wrote code for RangeMax property as:

Code: Select all

METHOD RangeMax ( nValue ) CLASS SPINNER

	If ::lCreated

	        If Pcount() == 0
	   
			RETURN ::oQTObject:Maximum() 

		ElseIf Pcount() == 1 

			::oQTObject:SetMaximum( nValue )

		EndIf

	ELse

	        If Pcount() == 0
	
			RETURN ::nRangeMax

		ElseIf Pcount() == 1 

			::nRangeMax := nValue

		EndIf

	EndIf
	
RETURN Nil
I am really worried about the code (which will lead to careless mistakes). It's 11:40 in India. I have to leave now.
(I don't know why "If" statements indents are not working properly)

Re: HMG 4 Started

Posted: Sat Aug 14, 2010 6:55 pm
by sudip
Spinner properties codes added, except Wrap.

Re: HMG 4 Started

Posted: Sat Aug 14, 2010 7:21 pm
by Roberto Lopez
sudip wrote:Spinner properties codes added, except Wrap.
Ok.

I'll review it later.

Another problem with your editbox code was that SetLineWrapMode is not the right way to handle scrollbars.

That must be done via SetHorizontalScrollBarPolicy and SetVerticalScrollBarPolicy.

I've already fixed and uploaded.

Re: HMG 4 Started

Posted: Sat Aug 14, 2010 7:29 pm
by sudip
Roberto Lopez wrote:
sudip wrote:Spinner properties codes added, except Wrap.
Ok.

I'll review it later.

Another problem with your editbox code was that SetLineWrapMode is not the right way to handle scrollbars.

That must be done via SetHorizontalScrollBarPolicy and SetVerticalScrollBarPolicy.

I've already fixed and uploaded.
Yes, I just updated the SVN and found your modification. Fantastic :) Thanks a lot.
I choose the wrong class (QSimpleTextEdit class was a wrong choice).

I believe every temporary failure has a path to success in disguise :)

Re: HMG 4 Started

Posted: Sat Aug 14, 2010 7:37 pm
by Roberto Lopez
sudip wrote: I believe every temporary failure has a path to success in disguise :)
No problem... all we are learning about QT. Was not easy to me to found the adequate properties in the reference.

Re: HMG 4 Started

Posted: Sat Aug 14, 2010 8:20 pm
by Roberto Lopez
sudip wrote:Spinner properties codes added, except Wrap.
Ok. It looks good.

Now... please consider that Spinner has more properties, events and methods that those listed in Spinner class.

Those properties are located at control.prg (control class) and were not coded yet. They are located there because they are shared with the other controls (ie: FontName, FontSize, etc.).

Thanks to inheritance, you can code only once to be inherithed by the other controls, so your work should continue there, until Spinner be completed.

You should combine your work with the rathinagiri one, since that he is coding checkbox that share properties, events and methods with spinner.

Re: HMG 4 Started

Posted: Sun Aug 15, 2010 4:58 am
by sudip
Hello Roberto,

Ok, I am working with the shared properties of FontName, FontSize etc.

Re: HMG 4 Started

Posted: Sun Aug 15, 2010 12:04 pm
by sudip
Hello,

I was trying with Fonts. But, there is some temporary problem of how to use QFont class, for which I need to learn more about HBQT objects. (I shall do it, but now it is not coming to my brain ;), Sorry)

Then, I added OnChange Event of Spinner. The trick is "valueChanged(int)" event. I got the hints from CheckBox and Button codes and HBQT Demo. Then searched HBQT source code for OnChange, they call it "valueChanged".

There is a proposal. Instead of writing event character strings every time, can we use constants in the hmg.ch file as:

Code: Select all

//----------------- QT Events Constants ----------------

#define QT_EVE_TRIGGERED             "triggered()"
#define QT_EVE_TRIGGERED_B           "triggered(bool)"
#define QT_EVE_HOVERED               "hovered()"
#define QT_EVE_CLICKED               "clicked()"
#define QT_EVE_STATECHANGED_I        "stateChanged(int)"
#define QT_EVE_PRESSED               "pressed()"
#define QT_EVE_RELEASED              "released()"
#define QT_EVE_ACTIVATED_I           "activated(int)"
#define QT_EVE_CURRENTINDEXCHANGED_I "currentIndexChanged(int)"
#define QT_EVE_HIGHLIGHTED_I         "highlighted(int)"
#define QT_EVE_RETURNPRESSED         "returnPressed()"
#define QT_EVE_CLICKED_M             "clicked(QModelIndex)"
#define QT_EVE_VIEWPORTENTERED       "viewportEntered()"
#define QT_EVE_VALUECHANGED_I    "valueChanged(int)"
...

Re: HMG 4 Started

Posted: Sun Aug 15, 2010 1:38 pm
by Roberto Lopez
sudip wrote:Hello,

I was trying with Fonts. But, there is some temporary problem of how to use QFont class, for which I need to learn more about HBQT objects. (I shall do it, but now it is not coming to my brain ;), Sorry)
I've used FontName and FontSize just as examples, you can pick any other one required.

Another good thing could be do solely in your 'assigned' code and if all goes fine it can be later moved to the control class to be inherited by the other controls.
sudip wrote: Then, I added OnChange Event of Spinner. The trick is "valueChanged(int)" event. I got the hints from CheckBox and Button codes and HBQT Demo. Then searched HBQT source code for OnChange, they call it "valueChanged".

There is a proposal. Instead of writing event character strings every time, can we use constants in the hmg.ch file as:

Code: Select all

//----------------- QT Events Constants ----------------

#define QT_EVE_TRIGGERED             "triggered()"

...
The strings match with reference data that you'll find in the official QT reference, so, I guess that in this 'learning stage' could be better keep the strings. They can be easy replaced by constants when the project reach beta status.

Re: HMG 4 Started

Posted: Sun Aug 15, 2010 1:43 pm
by sudip
Ok, thanks a lot, Roberto. :)