Events in the new version

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

Post Reply
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Events in the new version

Post by EduardoLuis »

Hi Dr. Claudio & Friends

I'm testing most of my frequently used routines and applications with new 3.30 & patch.-
I've discover an extrange behaviour in this sample.- Under 3.15 compilation works fine, under 3.30 all application becomes mad, really mad.-
I've attach an zip file containing both exe (3.15 compiled & 3.30 with patch compiled).- Source code is unique for both.-
With regards. Eduardo.
Attachments
mouse_over_2.rar
Source files
(1.19 KiB) Downloaded 469 times
mouse_over_version_2_COMPILED_WITH_330.rar
Executable file (3.3.0)
(1.04 MiB) Downloaded 483 times
mouse_over_version_2_COMPILED_WITH_315.rar
Executable file (3.1.5)
(819.66 KiB) Downloaded 492 times
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG 3.3.0 (Stable) Patch 1

Post by Pablo César »

EduardoLuis wrote:Hi Dr. Claudio & Friends

I'm testing most of my frequently used routines and applications with new 3.30 & patch.-
I've discover an extrange behaviour in this sample.- Under 3.15 compilation works fine, under 3.30 all application becomes mad, really mad.-
I've attach an zip file containing both exe (3.15 compiled & 3.30 with patch compiled).- Source code is unique for both.-
With regards. Eduardo.
Hola Eduardo,

No hay nada errado con la nueva version comparado con la version 3.1.5. Lo que pasa que en esta ultima hay más nuevas funciones, es decir hay más recursos. La forma que venias utilizando no estaba correcta a mi ver.
Modifiqué tu código y funciona compilando tanto en la actual como en la 3.1.5 tambien.

Code: Select all

#include <hmg.ch>
#define BLUE1 { 218,229,243 }
#define BLUE2 { 000,120,187 }
STATIC cCtrlAnt:="",  lProp:=.F.

Function Main

   DEFINE WINDOW w_test AT 000 , 000 WIDTH 230 HEIGHT 380 BACKCOLOR BLUE1 TITLE "SIMULATE A MOUSE OVER --- BY AGL" MAIN 
   
      ON KEY ESCAPE ACTION Thiswindow.Release()
    
      @ 030,010 LABEL LB_1 VALUE "Opcion 1" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 1" )
      @ 055,010 LABEL LB_2 VALUE "Opcion 2" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 2" ) 
      @ 080,010 LABEL LB_3 VALUE "Opcion 3" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 3" )
      @ 105,010 LABEL LB_4 VALUE "Opcion 4" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 4" )
      @ 130,010 LABEL LB_5 VALUE "Opcion 5" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 5" )
      @ 155,010 LABEL LB_6 VALUE "Opcion 6" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 6" )

      @ 250,000 LABEL LB_7 VALUE ""  WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR BLACK  CENTERALIGN TRANSPARENT 
	  
	  DEFINE STATUSBAR FONT "Courier New" SIZE 9
	      STATUSITEM PadC("",75)
	  END STATUSBAR

   END WINDOW
   CREATE EVENT PROCNAME SELECTCTRL() HWND W_test.HANDLE
   
   CENTER   WINDOW w_test
   ACTIVATE WINDOW w_test
RETURN Nil

FUNCTION SelectCtrl()
Local cCtrl, cForm, cTemp
Local hWnd := EventHWND()
Local wParam:= EventWPARAM()

If wParam <> w_test.HANDLE
   GetControlNameByHandle( wParam, @cCtrl, @cForm )
   cTemp:=ALLTRIM( cForm )+If(!Empty(cCtrl),"_"+ALLTRIM( cCtrl ),"")
   w_test.LB_7.VALUE := cTemp
   _SetItem ( 'StatusBar' , "w_test" , 1 , cTemp )
   IF cTemp==cForm
      IF lProp
         // La intencion es hacer que la Funcion acepte cualquier nombre de Ventana, pero de esta forma no se ejecuta el ACTION del LABEL !
         // The intention is to make the function accepts any window name, but this way the ACTION of LABEL is not running!
         SetProperty( "w_test", cCtrlAnt, "FONTBOLD" , .F. )
         SetProperty( "w_test", cCtrlAnt, "FONTSIZE" , 9   )
         SetProperty( "w_test", cCtrlAnt, "BACKCOLOR", BLUE2 )
         lProp:=.F.
      ENDIF
   ELSE
      IF ! empty(cCtrl)
         IF ! lProp
   		 SetProperty( "w_test", cCtrl, "FONTBOLD" , .T. )
            SetProperty( "w_test", cCtrl, "FONTSIZE" , 12   )
            SetProperty( "w_test", cCtrl, "BACKCOLOR", BLUE )
            cCtrlAnt:=cCtrl
            lProp:=.T.
         ENDIF
      ENDIF
   ENDIF
Endif
RETURN Nil
Sobre tus mensajes con anexo, que es lo que te pasaba ? Te daba algun mensaje de error (decinos cual) o no supiste anexarlo ? (Por favor respondeme todo esto, porque quiero saber). Re-edicté tu mensaje disponibilizando apenas los archivos que mencionas.

Espero haberte ayudado y que hayas entendido el código modificado.

Un abrazo/Pablo

Image

Hi Eduardo,

There is nothing wrong with the new version compared to version 3.1.5. What happened was that in the 3.3.0 there are more new features, ie more resources.
The way you were coming using was not correct in my opinion.
I modified your code and it works by compiling both the current as in 3.1.5 also.

About your posts with attached files, what happen to you ? Displayed any error message (pls tell us) or you did not know how to do it ? I re-edited your previous message making available the files you have mentioned.

I hope this would helps and you have understood the modified code.

A hug / Pablo
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Events in the new version

Post by Pablo César »

EduardoLuis wrote:La intencion es hacer que la Funcion acepte cualquier nombre de Ventana
Hola Eduardo, en esta cuestion, yo te diria que mantuvieras una función de controlar los eventos para cada form.

No te funcionaba bien, porque no todos los eventos tienen haber con el form. Es decir, a veces el form viene vacio. Entonces debes solo atribuir nuevo valor al cForm cuando no es vacio.

Saludos/Pablo

Image
EduardoLuis wrote:The intention is to make the function accepts any window name
Hi Eduardo, in this question, I would tell you to keep it a function to handle events for each form.

Do not work well because not all events are relationated with the form. I mean, sometimes the form is empty. Then you just need to assign new value to cForm when it is not empty.

Rgds/Pablo
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Events in the new version

Post by EduardoLuis »

Hola Pablo:

Desde ya gracias por tu respuesta.- Estoy recompilando todos mis desarrollos con la nueva version 3.30 y su patch.- Como el comportamiento de mouse over resultó diferente del que tenía con la 3.15 lo subí.- Ahora voy a implementar tu código.-
Te pido disculpas en no haberte contestado antes.-
Con respecto al upload, el error fue mio por eso quedó resuelto en el ultimo envio.-
Nuevamente gracias por tus consejos. Un abrazo.-
Post Reply