hmg-4 Changelog

Moderator: Rathinagiri

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

Re: hmg-4 Changelog

Post by l3whmg »

Code: Select all

2011-10-03 17:50 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
   * source/toolbutton.prg
     * handle Parent o No parent within New Method; TODO check other methods
     ! Usage of ButtonWidth and ButtoHeight values

   * source/toolbar.prg
     * handle Parent o No parent within New Method; TODO check other methods
Cheers
Luigi from Italy
www.L3W.it
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: hmg-4 Changelog

Post by concentra »

Code: Select all

2011-10-03 16:45 UTC-0300 Mauricio Ventura Faria (<conc001 a+t gmail com>)
   * include/hmg.ch
     + Added DEFINE TOOLBUTTON command
[[]] Mauricio Ventura Faria
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: hmg-4 Changelog

Post by concentra »

Code: Select all

2011-10-06 07:54 UTC-0300 Mauricio Ventura Faria (<conc001 a+t gmail com>)
   * include/hmg.ch
     + Added STYLE <value> command used in toolbuttons
     + Added END DROPDOWN command
[[]] Mauricio Ventura Faria
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: hmg-4 Changelog

Post by concentra »

Hi All.
In the following code:

Code: Select all

#include "hmg.ch"

FUNCTION Main()

   LOCAL oWindow
   LOCAL oButton

   HbQt_ErrorSys()

   DEFINE WINDOW oWindow
      Width    200
      Height   100

      DEFINE BUTTON oButton
         Caption   'Test Dialog'
         OnClick   TestDialog()
      END BUTTON
   END WINDOW

   oWindow:Activate()

RETURN NIL

/*************************/
STATIC FUNCTION TestDialog()
/*************************/

   LOCAL oDlg
   LOCAL oButtonBox

   DEFINE DIALOG oDlg TOVAR oDlg
      Width   120
      Height  75
   END DIALOG

   ACTIVATE DIALOG oDlg

RETURN NIL
If I remove TOVAR oDlg I get an error because the dialog isn't assigned to the oDlg var.
This sounds strange to me, I thought DEFINE DIALOG oDlg was enough.

Is this the expected behavior ?
[[]] Mauricio Ventura Faria
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: hmg-4 Changelog

Post by l3whmg »

Hi Mauricio.
the TOVAR option is required/mandatory if you need to assign object in a LOCAL/PRIVATE/PUBLIC var.
This was introduced some time ago to have this ability and to kept HMG3 compatibility.
THIS is not required by WINDOW object and about DIALOG, probably, is a mistake because is like a WINDOW.
I think must be fixed.

Cheers
Luigi from Italy
www.L3W.it
User avatar
concentra
Posts: 256
Joined: Fri Nov 26, 2010 11:31 am
Location: Piracicaba - Brasil

Re: hmg-4 Changelog

Post by concentra »

Hi Luigi
l3whmg wrote:the TOVAR option is required/mandatory if you need to assign object in a LOCAL/PRIVATE/PUBLIC var.
Ok, but it still sounds strange to me.
In my brain, if I define a control the object is assigned to a var with the name of the control...
[[]] Mauricio Ventura Faria
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: hmg-4 Changelog

Post by l3whmg »

Hi Mauricio.
IMHO, not strange. Please don't confuse LOCAL object with HMG4 (internal) object.

In OOP style you can write:

Code: Select all

WITH OBJECT objectClass():New()  * HMG4 (internally) create this reference "HMG_OBJECT_1" that is an object
WITH OBJECT objectClass():New("MyReference")  *HMG4 (internally) use this reference and is an object
(ie if it's a textbox you can use MyForm:HMG_OBJECT_1:Value or MyForm:MyReference:Value)

but these are not "local object" inside your application program. With HMG3 (not about Window) is ( +- ) the same and a foundamental was "keep the HMG3 compatibility".

In other words DEFINE TEXTBOX MyTextbox doesn't create a "local object" but an internal HMG3 "object" and you can use "MyTextBox" as a reference.

But now we can have (or we can use) a REAL local "object" reference in this way

Code: Select all

WITH OBJECT oMyLocal := objectClass():New()  HMG4 (internally) create this reference "HMG_OBJECT_1" that is an object
WITH OBJECT oMyLocal := objectClass():New("MyReference")   HMG4 (internally) use this reference and is an object
oMyLocal is the local "container....pointer....". Take a look to the first letter: "o", it means (give me a cent) object.

With previous translation commands was mandatory to code LOCAL oMyLocal, but in this way there wasn't a backward HMG3 compatibility, because DEFINE TEXTBOX MyTextBox must be translated into

Code: Select all

LOCAL MyTextBox
WITH OBJECT MyTextbox
.....
END WITH
that is very different from HMG3

To solve this, I've introduced the "TOVAR" option. In this way we can preserve HMG3 compatibility (see commands), we can use a reference (ie MyTextBox) to get/set an object (ie MyForm:MyReference) and extend OOP usage with local object.

You can compare some HMG3 demo and some HMG4 demo (arranged): they are (about) the same.
Cheers
Last edited by l3whmg on Thu Oct 06, 2011 3:51 pm, edited 1 time in total.
Luigi from Italy
www.L3W.it
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: hmg-4 Changelog

Post by l3whmg »

Hi friends.
About translator must be considered an experiment, a pov. Anyway, with samples/agoodstart/demo_3.prg you can show a possible usage for German and Spanish language. I want remember that, at this moment, the translation can be done about standard Qt dialogs and not for custom object. As you can see in demo_3.prg, buttons show English language.
There is a lot of work.
Here you can find a related problem here viewtopic.php?f=34&t=1679&start=140

Code: Select all

2011-10-06 17:35 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
   + samples/agoodstart/translations
   + samples/agoodstart/translations/qt_es.qm
   + samples/agoodstart/translations/qt_de.qm
   + samples/agoodstart/demo_3.prg
     * to show usage of Qtranslator

   * source/hmgapp.prg
     * WindowsDefined method: added check about INvisible form. Now stop
       a close event if there are hidden forms
     * WindowsDefined method: close window in reverse order. It's a test.
       Previous source code has been commented out
     + QTranslator handler based upon previous localization methods; to solve
       problem about retrieving current QT setting, I have introduced a method
       to tell where are located translations files: the path. You can set this
       value using HMGAPP():TranslDir( "pathName" ).
     ; With value returned by the QLocale object we build the name of the
       file will be loaded (ie qt_de, qt_es) and with HMGAPP():Localized method
       we can set a different language (change the current Qlocale)
       To know the name of the file will be loaded, can be used 
       HMGAPP():TranslFile. nb. can be also used to assign, but file must be
       located inside HMGAPP():TranslDir() folder
     ; TODO: when will be implemented HbQt QLibraryInfo() class, will be
       possible to remove TranslDir and related var or use them in other way
     ; REMEMBER MOST IMPORTANT: translating can be possibile for standard
       dialogs, not for custom dialog. Not for all languages there are
       translating files (ie there isn't qt_it.qm and I'm Italian)
Luigi from Italy
www.L3W.it
User avatar
Rathinagiri
Posts: 5481
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: hmg-4 Changelog

Post by Rathinagiri »

Hi Luigi,

Whether unicode text can also be used as translation?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: hmg-4 Changelog

Post by l3whmg »

Hi friends
Many thanks to Mauricio to tell me about problem with dialog.
This object must be considered like a window.

Code: Select all

2011-10-06 18:25 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
   ! samples/dialog/demo_2.prg
   ! samples/dialog/demo_1.prg
     ! fixed code about protected data

   ! include/hmg.ch
     ! a bug about DEFINE DIALOG; this object must be considered like a window
       object. For this reason must be used this syntax
       With Object <oObj> := DIALOG():New( <"oObj"> and <oObj> must be a real
       varname.
Luigi from Italy
www.L3W.it
Post Reply