HMG 2.6.6

HMG announcements; Latest HMG-related news, releases, fixes and updates.

Moderator: Rathinagiri

User avatar
gfilatov
Posts: 515
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 7 times
Been thanked: 59 times
Contact:

Re: HMG 2.6.6

Post by gfilatov » Wed Oct 08, 2008 6:01 pm

Roberto Lopez wrote:
gfilatov wrote: There are no problems with values for tab child controls.
But an incompatibility exists for old codes which used zero value of row/col for containers self.
:o
Could you be so kind to post a little sample showing what exactly the problem is ? (I'm not sure of fully understand the situation).
Roberto,

You have already seen this sample and I know your reaction.
But users don't want to update the old code which worked properly in the previous HMG builds.

Code: Select all

/*
* MINIGUI - Harbour Win32 GUI library Demo
*
* Copyright 2002 Roberto Lopez <harbourminigui@gmail.com>
* http://harbourminigui.googlepages.com/
*/

#include "minigui.ch"

Function Main

   DEFINE WINDOW Form_0 ;
      AT 0,0 ;
      WIDTH 640 HEIGHT 480 ;
      TITLE 'MiniGUI ToolBar Demo' ;
      ICON 'DEMO.ICO' ;
      MAIN ;
      FONT 'Arial' SIZE 10 

      DEFINE STATUSBAR
         STATUSITEM 'HMG Power Ready!' 
      END STATUSBAR

      DEFINE MAIN MENU 
         POPUP '&File'
            ITEM '&Disable ToolBar Button'   ACTION Form_0.Toolbar_1.Button_1.Enabled := .F. 
            ITEM '&Enable ToolBar Button'   ACTION Form_0.Toolbar_1.Button_1.Enabled :=  .T. 
            SEPARATOR
            ITEM 'Get ToolBar Button Caption' ACTION MsgInfo( Form_0.Toolbar_1.Button_1.Caption) 
            SEPARATOR
            ITEM 'Set ToolBar Button Caption' ACTION SetProperty ( 'Form_0' , 'ToolBar_1' , 'Button_1' , 'Caption' , 'New New' ) 
            SEPARATOR
            ITEM '&Exit'         ACTION Form_0.Release
         END POPUP
         POPUP '&Help'
            ITEM '&About'      ACTION MsgInfo ("MiniGUI ToolBar demo") 
         END POPUP
      END MENU

      DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 85,85 FLAT BORDER 

         BUTTON Button_1 ;
         CAPTION '&More ToolBars...' ;
         PICTURE 'button1.bmp' ;
         ACTION Modal_Click()  TOOLTIP 'ONE'

         BUTTON Button_2 ;
         CAPTION '&Button 2' ;
         PICTURE 'button2.bmp' ;
         ACTION MsgInfo('Click! 2')  TOOLTIP 'TWO'

         BUTTON Button_3 ;
         CAPTION 'Button &3' ;
         PICTURE 'button3.bmp' ;
         ACTION MsgInfo('Click! 3')  TOOLTIP 'THREE'

      END TOOLBAR

   END WINDOW

   Form_0.Toolbar_1.Col := Form_0.Width - Form_0.Toolbar_1.Width - 15  // this problem string

   CENTER WINDOW Form_0

   ACTIVATE WINDOW Form_0

Return Nil

*-----------------------------------------------------------------------------*
Procedure Modal_CLick
*-----------------------------------------------------------------------------*

   DEFINE WINDOW Form_2 ;
      AT 0,0 ;
      WIDTH 400 HEIGHT 300 ;
      TITLE 'ToolBar Test'  ;
      MODAL NOSIZE 

      DEFINE TOOLBAR ToolBar_1 FLAT BUTTONSIZE 100,30 BOTTOM RIGHTTEXT 

         BUTTON Button_1 ;
         CAPTION '&Undo' ;
         PICTURE 'button4.bmp' ;
         ACTION MsgInfo('UnDo Click!') 

         BUTTON Button_2 ;
         CAPTION '&Save' ;
         PICTURE 'button5.bmp' ;
         ACTION MsgInfo('Save Click!') 

         BUTTON Button_3 ;
         CAPTION '&Close' ;
         PICTURE 'button6.bmp' ;
         ACTION Form_2.Release

      END TOOLBAR

   END WINDOW

   Form_2.Center

   Form_2.Activate

Return Nil
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
Roberto Lopez
HMG Founder
Posts: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Wed Oct 08, 2008 9:30 pm

gfilatov wrote:
Roberto Lopez wrote:
gfilatov wrote: There are no problems with values for tab child controls.
But an incompatibility exists for old codes which used zero value of row/col for containers self.
:o
Could you be so kind to post a little sample showing what exactly the problem is ? (I'm not sure of fully understand the situation).
Roberto,

You have already seen this sample and I know your reaction.
But users don't want to update the old code which worked properly in the previous HMG builds.
Grigory,

Please, be sure that is my intention to do all necessary changes to code to assure backwards compatibility,
but, as far as I can remember, ToolBar, never had 'row', 'Col', 'Width' or ' Height' properties, since these values
are determined automatically by control itself, so, there is not 'backwards compatibility' to protect.

Anyway, I'm sure that I'm missing something important... maybe, some people used these properties with TooBars, since the code (row/col properties) is generic?

If so, I have no problem about to modify the code, but I want to know the reason to do it.


Thanks in advance.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Wed Oct 08, 2008 9:44 pm

Roberto Lopez wrote: Grigory,

Please, be sure that is my intention to do all necessary changes to code to assure backwards compatibility,
but, as far as I can remember, ToolBar, never had 'row', 'Col', 'Width' or ' Height' properties, since these values
are determined automatically by control itself, so, there is not 'backwards compatibility' to protect.
And... I've tested the sample with an *old* HMG version (2.0.032) and the 'line' about ToolBar 'Col' does 'nothing'...
so... I'm completely lost on this....

Again... any clarification is welcome.

Thanks in advance.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
gfilatov
Posts: 515
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 7 times
Been thanked: 59 times
Contact:

Post by gfilatov » Thu Oct 09, 2008 7:50 am

Roberto Lopez wrote:
Roberto Lopez wrote: Grigory,

Please, be sure that is my intention to do all necessary changes to code to assure backwards compatibility,
but, as far as I can remember, ToolBar, never had 'row', 'Col', 'Width' or ' Height' properties, since these values
are determined automatically by control itself, so, there is not 'backwards compatibility' to protect.
And... I've tested the sample with an *old* HMG version (2.0.032) and the 'line' about ToolBar 'Col' does 'nothing'...
so... I'm completely lost on this....

Again... any clarification is welcome.
Roberto,

I was not accurate in aboved sample. :|

Take a look for the real user's code:

Code: Select all

...
LJANELA     := GETDESKTOPWIDTH()  // Largura
AJANELA     := GETDESKTOPHEIGHT() - 20 // Altura
DEFINE WINDOW janela1 AT LINHA,COLUNA WIDTH LJANELA HEIGHT AJANELA TITLE HB_OEMTOANSI(PROGRAMA) ICON "ICONECO" MAIN NOMINIMIZE NOMAXIMIZE NOSIZE
  DEFINE STATUSBAR OF janela1 FONT 'Verdana' SIZE 07
    STATUSITEM HB_OEMTOANSI(LINHASTATUS) ICON "ICONECO" WIDTH 200
    DATE  WIDTH 100
    CLOCK WIDTH 090
  END STATUSBAR
  DEFINE MAIN MENU OF janela1
    POPUP '&Sistema'
      ITEM '&Finaliza'       ACTION finaliza()
    END POPUP
    POPUP 'Ajuda'
      ITEM '&Indice' ACTION DISPLAY HELP MAIN
      SEPARATOR
      ITEM '&Sobre o Sistema Config' ACTION wn_sobre()
    END POPUP
  END MENU
  DEFINE TOOLBAR barraprincipal OF janela1 BUTTONSIZE 70,45 FONT 'Arial' SIZE 10 FLAT BORDER BREAK
    BUTTON botaosaida CAPTION '&Finaliza' PICTURE 'BMPFINALIZA' ACTION {||finaliza()} SEPARATOR
  END TOOLBAR   
  c_geral := GETCURRENTFOLDER()
  w_faixabarra := ALLTRIM(c_geral) + '\logo0.JPG'
  IF FILE((w_faixabarra))
     w_linhabarra := janela1.barraprincipal.ROW + 3  // <-- take a look here
     w_colunabarra := janela1.WIDTH - 150
     w_alturabarra := janela1.barraprincipal.HEIGHT + 10
     @ w_linhabarra,w_colunabarra IMAGE faixabarra PICTURE w_faixabarra WIDTH 148 HEIGHT w_alturabarra STRETCH
  ENDIF
  w_linha := janela1.barraprincipal.ROW + janela1.barraprincipal.HEIGHT + 21  // <-- and here
  w_linha := w_linha + 50
  w_coluna := COLUNA + 20
  @ w_linha,w_coluna LABEL l_senha OF janela1 VALUE 'Senha' WIDTH 80 HEIGHT 40 FONT 'Times New Roman' SIZE 16 LADIREITA
  w_coluna := janela1.l_senha.COL + janela1.l_senha.WIDTH + 5
  @ w_linha,w_coluna TEXTBOX lc_senha OF janela1 HEIGHT 24 WIDTH 085 PASSWORD MAXLENGTH 08 UPPERCASE
  w_coluna := janela1.lc_senha.COL + janela1.lc_senha.WIDTH + 15
  @ w_linha,w_coluna BUTTON botaoseok OF janela1 CAPTION "C&ontinua" ACTION {||wn_config()} WIDTH 85 HEIGHT 28
END WINDOW
janela1.lc_senha.SETFOCUS
ACTIVATE WINDOW janela1
...
I agree that it's mistaked code for toolbar's ROW and HEIGHT but it worked smoothly at previous builds :oops:

That's all :!:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
Roberto Lopez
HMG Founder
Posts: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Thu Oct 09, 2008 5:03 pm

gfilatov wrote:
I was not accurate in aboved sample. :|

Take a look for the real user's code:
<...>
I agree that it's mistaked code for toolbar's ROW and HEIGHT but it worked smoothly at previous builds :oops:

That's all :!:
Ok.

Thanks for the sample.

I'm a little busy right now, but I'll take a look at it ASAP and post my opinion about that.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Fri Oct 10, 2008 12:18 pm

gfilatov wrote: I agree that it's mistaked code for toolbar's ROW and HEIGHT but it worked smoothly at previous builds :oops:
That's all :!:
mmm.... I'm afraid not so 'smoothly' :)

I need to research a little more and could be missing something, but I've found the following:

- Row and Col always return 0.

- Width and Height always return button size only when 'ButtonSize' clause is specified.

So, even patching MiniGUI to avoid the runtime error, the values returned are 'fake'.

Please, take a look at lines 171-174 in 'h_toolbar.prg'

_HMG_SYSDATA [ 18 ] [k] := 0
_HMG_SYSDATA [ 19 ] [k] := 0
_HMG_SYSDATA [ 20 ] [k] := nButtonWidth
_HMG_SYSDATA [ 21 ] [k] := nButtonHeight

So... yes... I'll modify _GetControlRow(), _GetControlWidth(), _GetControlHeight() and _GetControlCol() functions but to add error checking to prevent
the users that use it with ToolBars.

Sometimes, fixing a bug, is not only to patch the code to avoid a runtime error, sometimes you must look at the whole picture to make design decisions beyond 'patching', sometimes, this implies to not allow to users to write 'non-sense' code.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
gfilatov
Posts: 515
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 7 times
Been thanked: 59 times
Contact:

Post by gfilatov » Fri Oct 10, 2008 1:01 pm

Roberto Lopez wrote:<...>
Sometimes, fixing a bug, is not only to patch the code to avoid a runtime error, sometimes you must look at the whole picture to make design decisions beyond 'patching', sometimes, this implies to not allow to users to write 'non-sense' code.
Roberto,

Thanks a lot for your explanation, Master :!:

I'm glad to help for improvement of HMG. :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

User avatar
Roberto Lopez
HMG Founder
Posts: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Fri Oct 10, 2008 3:40 pm

gfilatov wrote: Thanks a lot for your explanation, Master :!:

I'm glad to help for improvement of HMG. :idea:
Ok :)

I've not attempted to be 'aggressive', I've only tried to demonstrate a point. That's all.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

Post Reply