UCI - MYBUTTON

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
danielmaximiliano
Posts: 2613
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

UCI - MYBUTTON

Post by danielmaximiliano »

Hi / Hola :

El ejemplo desarrollado por Roberto Lopez definido en Adavance - User Components en C:/hmg.3.0.46/doc/data/index.htm
nos deja una posibilidad de crear nuestros propios controles.
este ejemplo viene arrastrando errores que no permiten compilar, Pablo Cesár corrigio estos problemas, ahora se puede compilar desde HMG.3.0.46

hice una pequeña correccion al ejemplo propuesto por Pablo.
recuerde leer Readme.txt que viene acompañado en la carpeta del ejemplo.

Translate Google :

The example developed by Roberto Lopez defined in Adavance - User Components
In C:/hmg.3.0.46/doc/data/index.htm
gives us a chance to create our own controls.
This example has been dragging compile errors that prevent, Pablo Cesár corrected these problems, now can be compiled from
HMG.3.0.46

I made a small correction to the example given by Pablo.
remember to read Readme.txt that comes with the folder of the example.
C:\hmg.3.0.46\SAMPLES\USER.COMPONENTS

Code: Select all

/*
* HMG User Components Demo
* (c) 2006 Roberto Lopez
*/

#include "hmg.ch"

*Set Procedure To mybutton.prg

Function Main

	DEFINE WINDOW Win1 ;
		AT         0,0 ;
		WIDTH      400 ;
		HEIGHT     300 ;
		TITLE 'Custom Component Demo' ;
		MAIN 

		DEFINE MAIN MENU
			DEFINE POPUP 'Test'
			    MENUITEM 'Custom Method: SetFocus'        ACTION Win1.Test2.SetFocus
                MENUITEM 'Custom Method: Disable'         ACTION Win1.Test2.Enabled:= .F.
                MENUITEM 'Custom Method: Enable'          ACTION Win1.Test2.EnableD:= .T.
                MENUITEM 'Custom Property: Handle  (Get)' ACTION MsgInfo( Str( GetProperty( "Win1" , "Test2" , "Handle" ) ) )
                MENUITEM 'Custom Property: Handle  (Set)' ACTION SetProperty(               "Win1" , "Test2" , "Handle" , 1 )
                MENUITEM 'Custom Property: Caption (Get)' ACTION MsgInfo ( Win1.Test2.Caption )
                MENUITEM 'Custom Property: Caption (Set)' ACTION Win1.Test2.Caption := 'New Caption'
			END POPUP
		END MENU

		@ 10 , 10 MYBUTTON test2 ;
			OF Win1 ;
			CAPTION 'Custom Button' ;
			ACTION MsgInfo('Click!') 
			
	    @ 50 , 10 Label Thanks;
	              AUTOSIZE ;
		          VALUE 'Thanks Pablo César                 ' 
		@ 70 , 10 Label Thanks1;
	              AUTOSIZE ;
		          VALUE 'for the contribution to the example' 
		@ 90 , 10 Label Thanks2;
	              AUTOSIZE ;
		          VALUE ' MYBUTTON in UCI                   ' ;
		          ACTION msginfo('Test UCI')

	END WINDOW

	CENTER WINDOW Win1

	ACTIVATE WINDOW Win1

Return

Custom Component Demo_2012-11-16_18-08-30.jpg
Custom Component Demo_2012-11-16_18-08-30.jpg (14.58 KiB) Viewed 2791 times
Last edited by danielmaximiliano on Fri Nov 16, 2012 9:51 pm, edited 1 time in total.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

UCI - MYBUTTON

Post by Pablo César »

Thank you amigo Daniel, for your support !!

Yo consegui, pero sin hacer las alteraciones del Readme. // I got it too.
Las hice todas dentro del demo.prg, fijate funciona bien: // I made all changings in demo.prg and it works good:

Code: Select all

/*
* HMG User Components Demo
* (c) 2006 Roberto Lopez
*/

#include "hmg.ch"

#xcommand @ <row>,<col> MYBUTTON <name> ;
			OF <parent> ;
			CAPTION <caption> ;
			ACTION <action> ;
			=> ;
			_DefineMyButton(<"name">,<row>,<col>,<caption>,<{action}>,<"parent">)
	
#xtranslate <Window> .<Control>.Disable  => Domethod ( <"Window">, <"Control"> , "Disable" )
#xtranslate <Window> .<Control>.Enable  => Domethod ( <"Window">, <"Control"> , "Enable" )
#xtranslate <Window> .<Control>.Handle  => GetProperty ( <"Window">, <"Control"> , "Handle" )
#xtranslate <Window> .<Control>.Handle  := <v> => SetProperty ( <"Window">, <"Control"> , "Handle" , <v> )

Set Procedure To MyButton.Prg

Function Main

	DEFINE WINDOW Win1 ;
		AT 0,0 ;
		WIDTH 400 ;
		HEIGHT 200 ;
		TITLE 'Custom Component Demo' ;
		MAIN 

		DEFINE MAIN MENU
			DEFINE POPUP 'Test'
				MENUITEM 'Custom Method: SetFocus' ACTION Win1.Test.SetFocus
				MENUITEM 'Custom Method: Disable' ACTION Win1.Test.Disable
				MENUITEM 'Custom Method: Enable' ACTION Win1.Test.Enable
				MENUITEM 'Custom Property: Handle (Get)' ACTION MsgInfo ( Str ( Win1.Test.Handle ) )
				MENUITEM 'Custom Property: Handle (Set)' ACTION Win1.Test.Handle := 1
				MENUITEM 'Custom Property: Caption (Get)' ACTION MsgInfo ( Win1.Test.Caption )
				MENUITEM 'Custom Property: Caption (Set)' ACTION Win1.Test.Caption := 'New Caption'
			END POPUP
		END MENU

		@ 10 , 10 MYBUTTON test ;
			OF Win1 ;
			CAPTION 'Custom Button' ;
			ACTION MsgInfo('Click!') 

	END WINDOW

	CENTER WINDOW Win1

	ACTIVATE WINDOW Win1

Return
Dejé la linea Set Procedure To MyButton.Prg pero exclui del proyecto. Antes de excluir archivo con el IDE, haz una cópia del MyButton.Prg para no perderlo.
Screen55.PNG
Screen55.PNG (8.92 KiB) Viewed 2782 times
De esta forma me parece más personalizado.

---

I leave the line Set Procedure To MyButton.Prg but I have excluded from the project file. Before you delete file from IDE, make one copy of MyButton.prg, just for not loosing it.
I made this, because I think is more esclusive.
Last edited by Pablo César on Fri Nov 16, 2012 9:59 pm, edited 1 time in total.
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

UCI - MYBUTTON

Post by Pablo César »

In C:\MiniGUI\SAMPLES\Advanced\AVI_Animation are another interesting example of UCI. And also in ActiveX.prg too.
Screen56.PNG
Screen56.PNG (55.97 KiB) Viewed 2780 times
You are very kind, but is not my UCI example... :)
Last edited by Pablo César on Fri Nov 16, 2012 10:02 pm, edited 2 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
danielmaximiliano
Posts: 2613
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: UCI - MYBUTTON

Post by danielmaximiliano »

Perfecto Pablo:
mejor no tocar nada en la carpeta Include, esperemos que a todos les guste tú aporte y sea incluido en la proxima HMG.
yo omiti SET PROCEDURE para no tener problemas de duplicacion de funciones/procedimientos

Perfect Pablo:
better not touch anything in the Include folder, hopefully everyone likes your contribution and be included in the next HMG.
I omitted SET PROCEDURE to avoid problems of duplication of functions / procedures
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: UCI - MYBUTTON

Post by Pablo César »

danielmaximiliano wrote:mejor no tocar nada en la carpeta Include
Si, tambien soy de la misma opinion !
esperemos que a todos les guste tú aporte y sea incluido en la proxima HMG
Si asi, no se complica tanto. Lo único que MyButton solo servirá para ese proyecto y no quedaria aprovechable para futuro proyectos.
yo omiti SET PROCEDURE para no tener problemas de duplicacion de funciones/procedimientos
Si, claro. Yo tambien habia hecho eso, pero me pareció mejor adicionarlo con el Set Procedure, queda más práctico.

--- In English
danielmaximiliano wrote:better not touch anything in the Include folder
Yes, I am also of the same opinion!
I hope everyone likes your indication and it could be included for next HMG releases
Yeah, in that way it is not so complicated. The only bad thing is that MyButton only will be served for this project and would not be usable for future projects.
I omitted SET PROCEDURE to avoid problems of duplication of functions / procedures
Yeah, right. I had also done that way, but I chose to add it SET PROCEDURE, is more practical.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
danielmaximiliano
Posts: 2613
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: UCI - MYBUTTON

Post by danielmaximiliano »

Pablo César wrote: You are very kind, but is not my UCI example... :)
Pablo :
no digo "Su Ejemplo"
digo " a el aporte al ejemplo"

Translatte Google :

Paul:
I say "his example"
I say "for the contribution to the example"
possibly been misinterpreted / posiblemente se haya interpretado mal.
Pablo Cesár wrote: Yeah, in that way it is not so complicated. The only bad thing is that MyButton only will be served for this project and would not be usable for future projects.
Everything serves Pablo, is a practical way to learn and simple to apply to a project UCI.
Todo sirve pablo, es una forma practica y simple para aprender a aplicar UCI a un proyecto.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply