Page 1 of 1

HYPERLINK - GetProperty

Posted: Mon Nov 21, 2016 7:11 pm
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 ?

Re: HYPERLINK - GetProperty

Posted: Mon Nov 21, 2016 11:47 pm
by srvet_claudio
I will check

HYPERLINK - GetProperty

Posted: Tue Nov 22, 2016 1:46 pm
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 5485 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