HMG 4 Started

Moderator: Rathinagiri

Post Reply
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: HMG 4 Started

Post 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)
With best regards,
Sudip
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: HMG 4 Started

Post by sudip »

Spinner properties codes added, except Wrap.
With best regards,
Sudip
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMG 4 Started

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

Roberto


(Veritas Filia Temporis)
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: HMG 4 Started

Post 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 :)
With best regards,
Sudip
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMG 4 Started

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

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMG 4 Started

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

Roberto


(Veritas Filia Temporis)
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: HMG 4 Started

Post by sudip »

Hello Roberto,

Ok, I am working with the shared properties of FontName, FontSize etc.
With best regards,
Sudip
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: HMG 4 Started

Post 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)"
...
With best regards,
Sudip
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMG 4 Started

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

Roberto


(Veritas Filia Temporis)
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: HMG 4 Started

Post by sudip »

Ok, thanks a lot, Roberto. :)
With best regards,
Sudip
Post Reply