HYPERLINK - GetProperty
Posted: Mon Nov 21, 2016 7:11 pm
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):
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
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:
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 ?
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
But if you click at button "GET ADDRESS" before (when you just start the demo running), you will get a NIL
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 )
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 ?