hmg-4 Changelog

Moderator: Rathinagiri

Post Reply
mlacecilia
Posts: 22
Joined: Fri Oct 08, 2010 2:44 pm

Re: hmg-4 Changelog

Post by mlacecilia »

Hi,
in hmg\samples\statusbar\demo_5.prg

lines 115, 120, 125 and 130 are reporting an "invalid lvalue" error.
Best regards.
Maurizio
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

Code: Select all

2011-09-11 15:30 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
  ! samples/scrollbar/demo_2.prg
  ! samples/image/demo_1.prg
  ! samples/image/demo_2.prg
  ! include/hmg.ch
  ! hmg.hbp
  + source/bitmap.prg
  - source/image.prg
    * to avoid collision between IMAGE class and several IMAGE mthods.
      Now, we must use BITMAP():New instead IMAGE():New.
      To keep compatibility with HMG3 the command DEFINE IMAGE is
      translated into BITMAP():New
I read your message Maurizio. Next day I check and find solution: many thanks.

Cheers
Luigi from Italy
www.L3W.it
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: hmg-4 Changelog

Post by mrduck »

Code: Select all

2011-09-11 22:36 UTC+0200 Francesco Perillo (fperillo at gmail com>)
   * source/checkbox.prg
     * :value() returned always .F.
   * source/misc.prg
     * added function GetControlType
     * added function hmg_HexColor
       returns a CSS color string from the passed array (RGB)
   * source/tab.prg
     source/tabpage.prg
     * deleted duplicated code, removed a problem with accessing a protected
       data member
   * source/toolbar.prg
     * overloaded method flat() to a do-nothing method: in HMG3 it is possible
       to specify toolbar as flat but it is not possible in Qt where you
       need to specify it in the buttons. Now it avoids program error, patch
       should be created for the TOOLBUTTON to use this value
[/quote]
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: hmg-4 Changelog

Post by l3whmg »

This is an important Changelog, because we start to change the POW to handle signal e related block. This, for many reasons: 1) Qt and HbQt need/require a different way to handle them, 2) to optimize Hmg4
At this moment I have implemented about QT close method.

This is the default Hmg4 method to connect event and for this reason I suggest to handle only the Close event

Code: Select all

METHOD __HmgConnectEv() CLASS BASIC
   ::oQtObject:connect( QEvent_Close,             { |oEv| ::__HmgOnCloseExec(oEv) } )
RETURN Self
This is the default Hmg4 method to DISconnect event and for this reason I suggest to handle only the Close event

Code: Select all

METHOD __HmgDisconnectEv() CLASS BASIC
   ::oQtObject:disconnect( QEvent_Close )
RETURN Self
This can be considered the default Hmg4 method where signals are connected (please take a look to window.prg)

Code: Select all

METHOD Create() CLASS BASIC
   IF ::lCreated == .T.
      RETURN NIL
   ENDIF
   ::lCreated := .T.
   // Create inner controls
   ::CreatePendingChildControls()
   ::__HmgConnectEv()
   RETURN Self
This can be considered the default Hmg4 Release method

Code: Select all

METHOD Release() CLASS BASIC
   ::oQtObject:close()
RETURN NIL
This can be considered an example how to use the connecting method

Code: Select all

METHOD Create() CLASS TIMER
   IF ::lCreated == .T.
      RETURN NIL
   ENDIF
   ::lCreated := .T.
   // Create inner controls
   ::CreatePendingChildControls()
   ::__HmgConnectEv()
   ::oQTObject:Start( ::oQTObject:Interval )
RETURN Self
And this one the related customization:

Code: Select all

METHOD __HmgConnectEv() CLASS TIMER
   ::oQtObject:connect( QEvent_Close,             { |oEv| ::__HmgOnCloseExec(oEv) } )
   ::oQTObject:connect( "timeout()",              { || ::__HmgOnIntervalExec() } )
RETURN Self
A good example to show how can be used and customized an object is source/timer.prg

About window release method, I think now can handle in avery good way the INTERACTIVEONCLOSE option; please take a look to the source/virtualwindow.prg and __HmgOnCloseExec() method. On the other hand, you can find a different way to handle bOnMaximize and bOnMinimize (see __HmgOnChangeExec() method )

As you can see I give name to these methods in this way __Hmgxxxxxxx; 1) to prevent collision with other __ methods/function (I think about Harbour/Qt), 2) to put these methods at the end of the source (alphabetical order)

Code: Select all

2011-09-12 15:30 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
  + testing
  + testing/README
  + testing/internal_01
  + testing/internal_01/build.bat
  + testing/internal_01/hbmk.hbm
  + testing/internal_01/hmg.gif
  + testing/internal_01/qt.conf
  + testing/internal_01/test_01.prg
    * this folder is used ONLY to perform audits. Read carefully README

  ! samples/timer/demo_1.prg
    ! fixed problem about -w3 -es2 compilation flags
    - removed oWindow:release() now it's unusefull

  ! samples/window.close/demo_1.prg
    ! usage of SetInteractiveClose() method
    ! Win_1:LBL1:release() must be oStd:LBL1:release()

  ! source/layout.prg
  ! source/media.prg
  ! source/menuitem.prg
  ! source/timer.prg
    ! customized Release method. This can be considered the skeleton for
      Qt widget without :close() method.
    ; please take a look to timer.prg: this will be the future for a lot of
      HMG objects; some signal will be connect with __HmgConnectEv() through
      Create() method, but some signal in other form.
    ; about layout.prg the Release method ONLY for LAYOUTFORM class
    ; Yes, some of this object can't has children, but to have a standardized
      source code, in this moment, I kept the loop

  ! include/hmg.ch.prg
    ! "SET INTERACTIVECLOSE..." commands changed in according with new
      SetInteractiveClose() introduced in virtualwindow.prg

  * source/virtualwindow.prg
    + __HmgOnCloseExec(): connected method to handle QT close event
    + lClickOnXtoClose (INTERNAL) data. It means: by default (.T.) a form will
      be closed by clicking on [X] or ALT+F4. This value is set up to .F. ONLY
      within Release method. In this way we know when a Release method is
      requested or if the user press [X].
    * WindowStateChanged method renamed to __HmgOnChangeExec
    - OnStateChange() method removed: unusefull.
      Take a look to __HmgConnectEv() within window class
    ! OnMaximize() and OnMinimize() methods: now there value are evaluated by
      __HmgOnChangeExec
    + SetInteractiveClose() method to handle PROTECTED data

  * source/window.prg
    + __HmgConnectEv(): connecting method.
    + __HmgDisconnectEv(): DISconnecting method.
    ! remove test/call "Self:OnMinimize" and "Self:OnMaximize within Create
    ! fixed Release method
    ! fixed Create method
    ! fixed Activate method

  * source/basic.prg
    + __HmgConnectEv(): default connecting method.
      ONLY close event must be present.
    + __HmgDisconnectEv(): default DISconnecting method.
      ONLY close event must be present.
    + __HmgOnCloseExec(): default to handle QT close event
    ! fixed Release method
    ! fixed Create method

  ! source/misc.prg
    - unused var "i" within GetControlType function

  ! source/toolbar.prg
    + HB_SYMBOL_UNUSED( nValue ) within Flat method

  ! include/hmg.ch.prg
  ! samples/statusbar/demo_5.prg
    ! fixed a problem about statusbar. Many thanks Maurizio
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. I come back with a little fix in order to statusbar topic. See message from Maurizio.

Code: Select all

2011-09-12 18:30 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
  * samples/statusbar/demo_5.prg
    * named statusbar object with difference name to show usage and reference
      and to test changes within hmg.ch

  ! include/hmg.ch
    ! fixed both HMG3 and HMG4 statusbar command translation
I want use this topic to repeat something.
There are many differences between HMG3 and HMG4, but the two most important are:
- the array (_HMG_SYSDATA) VS the OOP style
- the reference VS the name of the object.

With HMG3 we use: DEFINE STATUSBAR [ OF | PARENT <ParentWindowName> ] ....
As you can see there isn't the <name> parameter; HMG3, by default, assigns, to this control, the name "StatusBar".
For this reason, we can handle some "statusitem" with: FormName.StatusBar.Item

With HMG4 always we give a name to the object: with an internal system or with a parameter.
This is the code: WITH OBJECT ..... StatusBar():New( cParam....
If we omit the cParam, this object will be named by HMG4 like _HMG_OBJECT_n (wher n >= 0 ) and within a program we can use FormName:_HMG_OBJECT_n:.... but we can't know <n>.

The best way is to assign the name/reference to the object within end program; so, the previous code will be:
WITH OBJECT ..... StatusBar():New( "ThisIsTheNameOfStatusBar"....
Now we have a fixed "reference" and we can use FormName:ThisIsTheNameOfStatusBar:....

But this is like OOP style; if we want use XBase style, we must translate
DEFINE STATUSBAR [ OF | PARENT <ParentWindowName> ] into OOP style.
But with HMG3 we don't have the <name>.

For this reason I have changed the Xbase coomand into
DEFINE STATUSBAR [ NAME <oObj> ] [ <dummy1: OF, PARENT> <oParent> ]
and the related translation with
WITH OBJECT StatusBar():New( iif(hb_IsNil( <oObj> ), "StatusBar", <"oObj">), [, <oParent> ] );;

This work with XBase style program. If we use OOP style, we can code
WITH OBJECT StatusBar():New( "ThisIsTheNameOfStatusBar"......

But at then end of the hmg.ch we find these rows:
#xtranslate <window>.StatusBar.Item(<nIndex>) => <window>:StatusBar:Item(<nIndex>)
#xtranslate <window>:StatusBar:Item(<nIndex>) => <window>:StatusBar:Item(<nIndex>)
#xtranslate <window>.StatusBar.Item(<nIndex>) := <cText> => <window>:StatusBar:Item(<nIndex>,<cText>)
#xtranslate <window>:StatusBar:Item(<nIndex>) := <cText> => <window>:StatusBar:Item(<nIndex>,<cText>)
// added to manage icon
#xtranslate <window>.StatusBar.ItemIcon(<nIndex>) => <window>:StatusBar:ItemIcon(<nIndex>)
#xtranslate <window>:StatusBar:ItemIcon(<nIndex>) => <window>:StatusBar:ItemIcon(<nIndex>)
#xtranslate <window>.StatusBar.ItemIcon(<nIndex>) := <xValue> => <window>:StatusBar:ItemIcon(<nIndex>,<xValue>)
#xtranslate <window>:StatusBar:ItemIcon(<nIndex>) := <xValue> => <window>:StatusBar:ItemIcon(<nIndex>,<xValue>)

as you can see, they use StatusBar "reference"! In other words, is encoded only the HMG3 style.
To have both HMG4 and HMG3 we must add/change into:
#xtranslate <window>.<objname>.Item(<nIndex>) => <window>:<objname>:Item(<nIndex>)
#xtranslate <window>:<objname>:Item(<nIndex>) => <window>:<objname>:Item(<nIndex>)
#xtranslate <window>.<objname>.Item(<nIndex>) := <cText> => <window>:<objname>:Item(<nIndex>,<cText>)
#xtranslate <window>:<objname>:Item(<nIndex>) := <cText> => <window>:<objname>:Item(<nIndex>,<cText>)
// added to manage icon
#xtranslate <window>.<objname>.ItemIcon(<nIndex>) => <window>:<objname>:ItemIcon(<nIndex>)
#xtranslate <window>:<objname>:ItemIcon(<nIndex>) => <window>:<objname>:ItemIcon(<nIndex>)
#xtranslate <window>.<objname>.ItemIcon(<nIndex>) := <xValue> => <window>:<objname>:ItemIcon(<nIndex>,<xValue>)
#xtranslate <window>:<objname>:ItemIcon(<nIndex>) := <xValue> => <window>:<objname>:ItemIcon(<nIndex>,<xValue>)

What I want to highlight is that: there are big difference between HMG4 and HMG3 philosopy.
A mix between XBase style and OOP style can be very dangerous.
A strict compatibility with HMG3 can preclude futures development of HMG4.
Sometimes we will have to get a compromise.

Cheers
Luigi from Italy
www.L3W.it
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: hmg-4 Changelog

Post by mrduck »

Code: Select all

2011-09-12 23:15 UTC+0100 Francesco Perillo (fperillo at gmail com)
   * samples/*.prg
     * too many files to list
       removed explicit :release() of objects at program end.
       Releasing or NIL is not required by hbQt, and standard GC
       should handle their deletion. If an error happens please
       report it.
       Removed since someone was thinking it was necessary to
       have them
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-09-13 14:51 UTC-0300 Mauricio Ventura Faria (<conc001 a+t gmail com>)
   ! samples/agenda/agenda.prg
   ! samples/agenda/build.bat
   + samples/agenda/qt.conf
     ! Translated to english.  Fixed build.bat.  Added missing qt.conf.
[[]] 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 »

mrduck wrote:If an error happens please report it.
Hi Francesco.
This one seems not related to what you did, but I was unable to trace.
And is weird !
In \samples\combobox\demo_3.prg line 43 we have:

Code: Select all

MenuItem "Combo 1 Get Item 2" ACTION MsgInfo( oWindow1.oCombo1.Item(2) )
and I got the error

Code: Select all

Error E0021  Circularity detected in #translate 'window'
The weird part is that if I remove the 2 from Item(2) the error vanishes...

Code: Select all

MenuItem "Combo 1 Get Item 2" ACTION MsgInfo( oWindow1.oCombo1.Item() )
And it also vanishes if oWindow1 reference is removed:

Code: Select all

MenuItem "Combo 1 Get Item 2" ACTION MsgInfo( oCombo1.Item(2) )
It also happens with \samples\everything\demo_1.prg line 115

Code: Select all

ITEM 'Get StatusBar Item 1' ACTION MsgInfo(oWindow.StatusBar.Item(1))
I need some help with this...
[[]] 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 »

Its related to Window, not MenuItem.
In samples\grid\demo_2 line 98

Code: Select all

LOCAL aLine := oWindow:oGrid:Item(4)
the same error rises.
[[]] 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 friends, ciao Mauricio :)

Code: Select all

2011-09-13 18:30 UTC+0100 Luigi Ferraris ( <luigi at l3w.it> )
   ! source/window.prg
     - oStatusBar var now unusefull
     - StatusBarSetGet() method now unusefull

   - samples/statusbar/resource
   - samples/statusbar/resource/login20x20.png
   - samples/statusbar/resource/logout20x20.png
   - samples/statusbar/car.ico
   - samples/statusbar/demo_4.prg
   - samples/statusbar/demo_5.hbp
   - samples/statusbar/demo_5.prg
   - samples/statusbar/demo_5.qrc
   - samples/statusbar/new.ico
   + samples/statusbar/bookclose.png
   + samples/statusbar/bookopen.png
   + samples/statusbar/demo_1.prg
   + samples/statusbar/demo_2.prg
   + samples/statusbar/demo_3.prg
   + samples/statusbar/stopball.png
     ! update to better show new usage of statusbar and related objects
       and to highlight differences between OOP style and XBase.

   ! include/hmg.ch
     ! #xcommand DEFINE STATUSBAR..., #xcommand STATUSITEM...,
       #xcommand DATE..., #xcommand CLOCK..., #xcommand KEYBOARD
     ; added [ NAME <oObj> ] [ <dummy1: OF, PARENT> <oParent> ] and fixed
       translation in according with changes on statusbar.prg

   ! source/statusbar.prg
     ! totally rewrited. Now there are these class objects:
       STATUSBAR, STATUSITEM, STATUSCLOCK, STATUSDATE and STATUSKEYB
     ; To kept compatibility between HMG3 and HMG4 are implemented:
       METHOD StatusDateAdd(...), METHOD StatusClockAdd(...)
       METHOD StatusKeybAdd(...), METHOD StatusItemAdd(...)
       HMG3 can access to the items using index reference are implemented:
       Item( nIndex, cCaption ) to know or update the caption of an item
       ItemCount() to know how many itmes it has
       ItemIcon( nIndex, cIcon ) to know or to update the icon of an item
       ItemRaised( nIndex, [.T.|.F.] ) to know or to update the raised option
       ItemRelease( nIndex ) to remove an item using index reference
       Anyway please refer to samples/statusbar demos.
Luigi from Italy
www.L3W.it
Post Reply