HMG4 event idea

Moderator: Rathinagiri

Post Reply
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

HMG4 event idea

Post by l3whmg » Thu Mar 03, 2011 4:53 pm

Hello everyone, I would like to have your opinion on whether to add two events to the form.

The names could be: "OnBeforeShow" and "OnAfterShow".
These two events would be triggered immediately before and after the statement "oQTObject: Show ()" in window.prg.

The reasons for this request is: often, it is useful to fill in the fields after a processing or perform a procedure, etc.
Since the form is not yet completely loaded I get errors

Another example that comes to me is this: in the OnInit function of the main form, I have to open another form. Based on the result of this operation I have to figure out whether to continue or not. With Hmg4 I have problems, but using the assumed event OnAfterShow everything works fine.

What do you think about this idea?

Best regards.
Luigi from Italy
www.L3W.it

User avatar
Rathinagiri
Posts: 5234
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG4 event idea

Post by Rathinagiri » Thu Mar 03, 2011 6:59 pm

Hi Luigi,

Kindly create the code along with some samples to demonstrate the same. Definitely your suggestion will be useful to all.

Thanks.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
esgici
Posts: 4452
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG4 event idea

Post by esgici » Thu Mar 03, 2011 7:37 pm

l3whmg wrote: ...
What do you think about this idea?
...
Hi Luigi

Good idea :idea:

Please continue :)

Regards

--

Esgici
Viva INTERNATIONAL HMG :D

User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: HMG4 event idea

Post by l3whmg » Fri Mar 04, 2011 1:14 pm

Hi guys,
Today it's not a good day..... I've written code but without good news :oops:

In fact, HMG4 have different core from HMG3: when you change a value inside OnInit event and other field depend by OnChange clause of this, with HMG3 you can receive error. with HMG4 no :D

I was hoping to find a way to see or do something immediately after the appearance of the form on the video, but without result. In according with documentation provided by QT, I created an event OnAfterShow, but I get the same result with the OnInit event. bAfterEvent first runs and then you see the form. In fact, putting a trivial MsgStop, I see the message first and then I see the form.

Anyway, this is a piece of code for windows.prg

Code: Select all

/*----------------------------------------------------------------------*/    //L3W
METHOD OnAfterShow( bValue ) CLASS WINDOW                                     //L3W
                                                                              //L3W
   IF ::lCreated                                                              //L3W
      IF PCOUNT() == 0                                                        //L3W
         RETURN ::bOnAfterShow                                                //L3W
      ELSEIF PCOUNT() == 1                                                    //L3W
         ::bOnAfterShow := bValue                                             //L3W
         IF .NOT. ::oQTObject:connect( QEvent_Show , {||EVAL( bValue ) } )    //L3W
            ::oQTObject:disconnect( QEvent_Show )                             //L3W
            IF .NOT. ::oQTObject:connect( QEvent_Show , {||EVAL( bValue ) } ) //L3W
               // Error                                                       //L3W
            ENDIF                                                             //L3W
         ENDIF                                                                //L3W
      ENDIF                                                                   //L3W
   ELSE                                                                       //L3W
      IF PCOUNT() == 0                                                        //L3W
         RETURN ::bOnAfterShow                                                //L3W
      ELSEIF pcount() == 1                                                    //L3W
         ::bOnAfterShow := bValue                                             //L3W
      ENDIF                                                                   //L3W
   ENDIF                                                                      //L3W
                                                                              //L3W
   RETURN NIL                                                                 //L3W
And this was translation command to use with DEFINE WINDOW

Code: Select all

#xcommand ONAFTERSHOW         <bvalue>  =>   :OnAfterShow         := <{bvalue}>
If someone have a better idea....

Best regards
Luigi from Italy
www.L3W.it

Post Reply