HMG.4 and "Onclick"

Moderator: Rathinagiri

Post Reply
Rossine
Posts: 87
Joined: Thu Jun 30, 2011 10:04 pm

HMG.4 and "Onclick"

Post by Rossine »

Hello All,

I'm trying to make a shortcut to a button, but the error is occurring in execution.

See the example below:

Code: Select all

/*
 * $Id: demo_2.prg 760 2011-10-21 12:01:51Z l3wonsf $
*/

/*
 * HMG 4 demo
 * (c) 2010 Roberto Lopez <mail.box.hmg@gmail.com>
*/

#include "hmg.ch"

FUNCTION Main

   LOCAL oWindow

   hbqt_errorsys()

   DEFINE MAINWINDOW oWindow
      Row    10
      Col    10
      Width  400
      Height 400
      Title  'Nice OOP Demo!!!'
      OnInit oWindow:Center()

     ON KEY ALT+A OF cWndForm ACTION cWndForm.oButton1.OnClick  // <- Here

      DEFINE TOOLBAR oToolBar1

         TOOLBUTTON oButton1 ;
            Caption 'new' ;
            picture 'new.png' ;
            ACTION MsgInfo( 'New!' ) ;
            tooltip 'tooltip'

         TOOLBUTTON oButton2 ;
            Caption 'open' ;
            picture 'open.png' ;
            ACTION MsgInfo( 'open!' ) ;
            tooltip 'tooltip'

      END TOOLBAR

   END WINDOW

   ACTIVATE WINDOW oWindow

   RETURN NIL
This is possible in hmg.4 ?

Best Regards,

Rossine.
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: HMG.4 and "Onclick"

Post by Ricci »

Please try this:

ON KEY ALT+A OF oWindow ACTION EVAL( oWindow:oToolBar1:oButton1:OnClick() )

And put the line behind the toolbar defnition block.
Rossine
Posts: 87
Joined: Thu Jun 30, 2011 10:04 pm

Re: HMG.4 and "Onclick"

Post by Rossine »

Hi Ricci,
Ricci wrote:Please try this:

ON KEY ALT+A OF oWindow ACTION EVAL( oWindow:oToolBar1:oButton1:OnClick() )

And put the line behind the toolbar defnition block.
Works 100% :D

Many thank´s,

Rossine.
Post Reply