HYPERLINK - GetProperty

Moderator: Rathinagiri

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

HYPERLINK - GetProperty

Post by Pablo César »

Hi Claudio,

I've broken my head why is not working GetProperty for HYPERLINKs.

Please hereunder note this simple code (based on C:\hmg.3.4.3\SAMPLES\Controls\HyperLink\demo.prg) for your testing
or just execute (by downloading this a executing):

Code: Select all

/*
 *
 * HMG Hyperlink Demo
 * Copyright 2005 Roberto Lopez <mail.box.hmg@gmail.com>
 * http://www.hmgforum.com//
 *
*/

#include "hmg.ch"

Function Main()
DEFINE WINDOW Main_form ;
	AT 0,0 ;
	WIDTH 397 ;
	HEIGHT 168 ;
	TITLE 'HyperLink Demo' ;
	MAIN NOSIZE 
    
	DEFINE HYPERLINK H1
		ROW		10
		COL		10
		VALUE		'http://www.hmgforum.com' 
		FONTNAME	'Arial' 
		FONTSIZE	9 
		AUTOSIZE	.T. 
		ADDRESS		'http://www.hmgforum.com'
		HANDCURSOR	.T.
	END HYPERLINK

	DEFINE BUTTON Button_1
	    ROW    40
	    COL    10
	    WIDTH  120
	    HEIGHT 28
	    ACTION MsgDebug(GetProperty("Main_form","H1","ADDRESS"),ValType(GetProperty("Main_form","H1","ADDRESS")))
	    CAPTION "GET ADDRESS"
	    FONTNAME "Arial"
	    FONTSIZE 9
	END BUTTON
	
	DEFINE BUTTON Button_2
	    ROW    80
	    COL    10
	    WIDTH  120
	    HEIGHT 28
	    ACTION (SetProperty("Main_form","H1","ADDRESS","http://www.google.com"),SetProperty("Main_form","H1","CAPTION","http://www.google.com"))
	    CAPTION "SET ADDRESS"
	    FONTNAME "Arial"
	    FONTSIZE 9
	END BUTTON
	
END WINDOW
CENTER WINDOW Main_form
ACTIVATE WINDOW Main_form
Return Nil
When you change the URL address at button "SET ADDRESS" it changes properly from hmgforum to google and displays correct the url (caption, url and all it's working perfectly).
But if you click at button "GET ADDRESS" before (when you just start the demo running), you will get a NIL :shock:

I know the HYPERLINK it's not exactly a particular control. It's also shared with LABEL... :?

Digging codes, I saw in h_label.prg at:

Code: Select all

_HMG_SYSDATA [  6 ]  [k] :=  if ( valtype ( ProcedureName ) = 'C' , if ( HMG_LOWER ( HB_ULEFT ( ProcedureName , 7 ) ) == 'http://' , {||ShellExecute(0, "open", "rundll32.exe", "url.dll,FileProtocolHandler " + ProcedureName , ,1)} , {||ShellExecute(0, "open", "rundll32.exe", "url.dll,FileProtocolHandler mailto:" + ProcedureName , ,1)} ) , ProcedureName )
And at two lines down, where _HMG_SYSDATA [ 8 ] [k] should it be assigned with strange value or lets say wrongly (IMO) by Nil :?
I think this one failed to assign the value ProcedureName as correct, isn't it Claudio ?
Like this:
_HMG_SYSDATA [ 8 ] [k] := ProcedureName

Otherwise, always will become NIL... :|

In case, please: could you confirm how can be solved ?
Attachments
demo2_Exe.rar
Executable file
(1.23 MiB) Downloaded 338 times
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HYPERLINK - GetProperty

Post by srvet_claudio »

I will check
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

HYPERLINK - GetProperty

Post by Pablo César »

Ok, Claudio: thanks for your usual attention.

I will wait for your answer for Prg2Fmg and I prepare a richest example of HYPERLINK but first I need your return.

I've checked in the forum , SAMPLES and DOC it's saying the property is a string and for me it's very important to keep it in _HMG_SYSDATA [ 8 ].
Screen10.png
Screen10.png (62.25 KiB) Viewed 5487 times
What I see that _HMG_SYSDATA [ 8 ] is useful in many other controls as a second reference/support.

I do not know how long it's like that...

Please, keep it.

B.Rgds
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply