Problem With isControlDefined

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Problem With isControlDefined

Post by Pablo César »

luisvasquezcl wrote:si es con o sin comillas ya que siempre funcionará
Gracias Luis y Dave. De facto es perfectamente aplicable lo indicado. Si realizas esta prueba verás:

Code: Select all

#include <hmg.ch>

#xtranslate IsCtrlDefined ( <ControlName> , <FormName> ) ;
=> ;
_IsCtrlDefined ( <"ControlName"> , <"FormName"> )

Function Main
DEFINE WINDOW Win_1 ;
    AT 0,0 ;
    WIDTH 400 ;
    HEIGHT 400 ;
    TITLE 'Hello World-2' ;
    MAIN
    
    DEFINE LABEL lblHello
        ROW 275
        COL 125
		WIDTH 150
        VALUE "Hello World !"
        FONTNAME "Lucida"
        FONTSIZE 16
    END LABEL
	
	DEFINE BUTTON Button_1
        ROW    340
        COL    140
        WIDTH  100
        HEIGHT 28
        ACTION IsCtrlDefined(lblHello,Win_1)
        CAPTION "Button_1"
        FONTNAME "Arial"
    END BUTTON

END WINDOW
CENTER WINDOW Win_1
ACTIVATE WINDOW Win_1
Return Nil

Function _IsCtrlDefined( ControlName, WindowName )
ControlName := CharRem( Chr(34)+Chr(39), ControlName )
WindowName := CharRem ( Chr(34)+Chr(39), WindowName )
Win_1.lblHello.Value:=ControlName+WindowName
MsgDebug( ControlName, WindowName, _IsControlDefined( ControlName, WindowName ) )
Return Nil
Gracias tambien por tu participacion, como siempre levantando cuestiones y asuntos de importancia.

Saludos,
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Rathinagiri
Posts: 5481
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Problem With isControlDefined

Post by Rathinagiri »

That is a very nice idea. We shall implement in the next version. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Problem With isControlDefined

Post by Pablo César »

Thank you Rathi !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2223
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Problem With isControlDefined

Post by srvet_claudio »

Pablo César wrote:
luisvasquezcl wrote:Asumi que la funcion llevaba los parametros entre comillas por eso no me funcionaba.
Seria bueno agregar un ejemplo pequeño a la documentacion para asi aclarar el correcto uso.
Está bien Luis, a mi ya me pasó várias veces. :oops:
Creo que no será necesário si adoptamos lo siguiente.

Dear Rathi,

If we add following at C:\hmg.3.4.1\SOURCE\h_controlmisc.prg as follows (grey backcolor):

Image
Doing this, It will be fine for both of ways. Even with single quotes Image or double quotes Image or even mixed.

What do you think, can be implemented at HMG core ? Then we can avoid any confusion about thhis old missundertanding.

Rgds
Done in IsControlDefine() and IsWindowDefine()
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Problem With isControlDefined

Post by Pablo César »

srvet_claudio wrote:Done in IsControlDefine() and IsWindowDefine()
Thank you Claudio ! :P

By the same way, could you apply also to:
  • IsWindowActive ==> _IsWindowActive function
And some others like (probably this would be not so necessary):
  • SET CONTROL <ControlName> OF <FormName> ==> _HMG_SetControlData function
  • SET TOOLTIPCUSTOMDRAW FORM <FormName> == > SetToolTipCustomDrawForm function
  • SET WINDOW <FormName> TRANSPARENT TO ==> SetLayeredWindowAttributes function
  • FLASH WINDOW <FormName> ==> FlashWindowEx function
  • ANIMATE WINDOW <FormName> ==> AnimateWindow function
Sorry to give you this work but we could set it for all with the same needing.
I do not know if there is some more.

B.Rgds
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
luisvasquezcl
Posts: 1261
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: Problem With isControlDefined

Post by luisvasquezcl »

Excelentes noticias aplicar este ajuste, hará las funciones mucho más flexibles y a toda prueba.
Gracias a todos.
Saludos cordiales,

Great news apply this setting, will make more flexible features and foolproof.
Thanks to all.
Best regards,
Post Reply