HMG 4 Started

Moderator: Rathinagiri

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,

Finally I created Editbox control. It's very basic.
#command was initially taken from TextBox control, I shall change later.

This is the first time I did it. I never did SVN Commit before. Very basic work. But I learned many things from this experience.


Hello Roberto, Rathi and others,

Please check my code and send your advice. And please correct any mistake in my code.


Thank you all. :)
Thanks... Nice Job!!!!

Some observations:

1. Please, add a commentary when commit changes (Tortoise commit window- 'message' frame) and don't forget to add a list with modified/deleted/added files (right click->Paste filename list ).

2. Other important thing is that you must 'double code' for prior/post control creation, since you can't access to a QT object before that this be created (done at Create() method executed by default at window activation).

So, your code must look at this:

Code: Select all

If ::lCreated

    * Access to QT object (ie)

    If pcount() == 0

        Return ::oQTObject:Something

    ElseIf pcount() == 1

        ::oOQTObject:Something(xValue)

    EndIf

Else

    * Access to instance variables only (ie)

    If pcount() == 0

        Return ::xVar

    ElseIf pcount() == 1

        ::xVar := xValue

    EndIf
   
EndIf
Thanks!
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 »

bootwan wrote: Please forgive me for the questions raised by.
I beg you that stop attacking and discrediting HMG at this forum.

Thank you very much.
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,
Thank you very much for your advice.
I am very Sorry. I saw your post after sending latest update.
Next time I shall follow your advice. (I did 2nd part of your advice, ie. If ::lCreated ...)

One point comes to my mind. I need to change hmg.ch file in future, for Editbox #command changes. But, that time if someone updates it with his changes, his change may be overwritten. So, is there any solution for this?
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 Roberto,
Thank you very much for your advice.
I am very Sorry. I saw your post after sending latest update.
Next time I shall follow your advice. (I did 2nd part of your advice, ie. If ::lCreated ...)

One point comes to my mind. I need to change hmg.ch file in future, for Editbox #command changes. But, that time if someone updates it with his changes, his
I'm just starting to learn about SVNchange may be overwritten. So, is there any solution for this?
I'm just starting to learning about SVN (the same as you) but, AFAIK, SVN system takes care about that, warning you when a possible conflict arises.

Another thing: All current classes already in place, have only basic functionality, so, besides creating a new class for a missing control, you could pick anyone of the existing to finish it (ie: Rathinagiri picked checkbox, an already existing one).
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: (I did 2nd part of your advice, ie. If ::lCreated ...)
Yes, but you've not coded for the 'else' situation (!::lCreated).

Please take a look at (ie) InputMask property in TextBox.
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 »

Roberto Lopez wrote:
sudip wrote: (I did 2nd part of your advice, ie. If ::lCreated ...)
Yes, but you've not coded for the 'else' situation (!::lCreated).

Please take a look at (ie) InputMask property in TextBox.
I've found some other mistakes:

EditBox has not this properties:

DATA nCaseConvert INIT 0
DATA nDataType INIT 0
DATA lPassWord INIT .F.
DATA cInputMask INIT Nil
DATA cFormat INIT Nil

And if it has its own Value property (not using the inherited one) you must not use the ::xValue variable (from control class). You must use ::cValue from your own class.

Please, check the HMG documentation about the control you are working on before proceed.

I'm correcting now and I'll upload the new code ASAP.
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:Hello Roberto,
Thank you very much for your advice.
I am very Sorry. I saw your post after sending latest update.
Next time I shall follow your advice. (I did 2nd part of your advice, ie. If ::lCreated ...)

One point comes to my mind. I need to change hmg.ch file in future, for Editbox #command changes. But, that time if someone updates it with his changes, his change may be overwritten. So, is there any solution for this?
Some other corrections:

DATA lLineWrap INIT .F.

This will be more clear if you use the HMG property name for class variables ie: lHScrollbar instead lLineWrap.

DATA lNoVScroll INIT .F.

The idea is to work with true properties instead 'propertized' xBase clauses, so, such thing as 'NoVscroll' is not correct for a property.

In this case it could be better (as I've done in LABEL and other controls) to create a new property and define some constants to handle its content.

So, we could have a property called 'ScrollBars' and its constants:

#define EDB_NONE 0
#define EDB_HSCROLL 1
#define EDB_VSCROLL 2
#define EDB_BOTH 3

Please take a look to the other controls to get an idea about how to do it:
* Constants *******************************************************************

* Window Type

#define WND_STANDARD 0
#define WND_MAIN 1
#define WND_CHILD 2
#define WND_PANEL 3
#define WND_MODAL 4
#define WND_SPLITCHILD 5

* Button PictAlignment

#define BTN_TOP 0
#define BTN_BOTTOM 1
#define BTN_LEFT 2
#define BTN_RIGHT 3

* Label Alignment

#define LBL_LEFT 0
#define LBL_CENTER 1
#define LBL_RIGHT 2

* TextBox Case Conversion

#define TXT_NONE 0
#define TXT_UPPER 1
#define TXT_LOWER 2

* TextBox DataType

#define TXT_CHARACTER 0
#define TXT_NUMERIC 1
#define TXT_DATE 2

* TextBox Alignment

#define TXT_LEFT 0
#define TXT_RIGHT 2

* ToolBar Button Styles

#define TBB_STANDARD 0
#define TBB_DROPDOWN 1
#define TBB_WHOLEDROPDOWN 2
#define TBB_CHECK 3
#define TBB_CHECKGROUP 4

* DatePicker Alignment

#define DTP_LEFT 0
#define DTP_RIGHT 2
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,

Thank you for your advice.

Editbox control is still incomplete. I started it using your Textbox control as base of my learning.

My latest updated SVN contains the "else" part.

The main problem I faced is hmg.ch (yes I saw the hmg documentation and i_editbox.ch). I couldn't correct some errors. I also mailed the #commands of editbox control for help. I couldn't figure out the compilation error due to my hmg.ch. Then I decided to use #commands of textbox control. I also said this in my first message about Editbox.

You are correct. I shall remove all unnecessary properties of Editbox control. At that time I didn't have any documentation for HBQT. Finally I got it from the HBQT source code of nightly harbour download. From there I solved return value problem of editbox (which is built on QPlainTextEdit class).

In the beginning, I wanted to delete unnecessary properties of Editbox control, but got errors. I shall remove them very soon.

The whole day long I worked to understand and solve problems of Editbox. (Yes, very late lunch ;) )

I shall do your advice.

(During writing this post I got more advice from you. Thanks a lot)
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: In the beginning, I wanted to delete unnecessary properties of Editbox control, but got errors. I shall remove them very soon.

The whole day long I worked to understand and solve problems of Editbox. (Yes, very late lunch ;) )

I shall do your advice.

(During writing this post I got more advice from you. Thanks a lot)
Maybe better if you continue the work that I've already started with another of the classes.

Those classes already had all needed #command definitions and adequate new properties defined when required, so you'll only need to complete the connection with QT for those properties, events and methods already defined.

Please, continue with Spinner and let me to continue your work on EditBox.

Thanks again.
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 »

Roberto Lopez wrote:
sudip wrote: In the beginning, I wanted to delete unnecessary properties of Editbox control, but got errors. I shall remove them very soon.

The whole day long I worked to understand and solve problems of Editbox. (Yes, very late lunch ;) )

I shall do your advice.

(During writing this post I got more advice from you. Thanks a lot)
Maybe better if you continue the work that I've already started with another of the classes.

Those classes already had all needed #command definitions and adequate new properties defined when required, so you'll only need to complete the connection with QT for those properties, events and methods already defined.

You can pick one of the following:

- Button
- Frame
- Label
- Spinner
- textBox

Please, continue with one of these and let me to continue your work on EditBox (rathinagiri is already working on CheckBox).

Thanks in advance.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply