Page 1 of 2

The current hyperlink from the table

Posted: Mon Jan 30, 2017 11:28 pm
by Eugene Lutsenko
Is it possible to make a field in the table the absolute value of a hyperlink so that when viewing this table clicking on this field we got the go to website?

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 3:41 am
by Auge_Ohr
Eugene Lutsenko wrote:Is it possible to make a field in the table the absolute value of a hyperlink so that when viewing this table clicking on this field we got the go to website?
you have to check in o:Itemselect Slot

Code: Select all

oBrowse:itemSelected := {| uNIL1, uNIL2, oSelf | DoIT(oSelf) } 
where you click

Code: Select all

FUNCTION DoIT(oBrowse)
LOCAL nCol := oBrowse:colPos
   ...
   IF nCol = 007
      HP_GOTO( FIELDGET(nCol) )
   ELSE
      // normal Code
   ENDIF 
next Code i use with Firefox.

Code: Select all

FUNCTION HP_GOTO(myhttpadr)
LOCAL oReg, uVal

   oReg := XbpReg():NEW('HKEY_CLASSES_ROOT\HTTP\shell\open\command')
   IF ! oReg:Status()
      MSGBOX("no Browser installed !")
      RETURN NIL
   ENDIF

   oReg:ReadBinType("C")
   uVal := oReg:Standard
   uVal := ALLTRIM( SUBSTR(uVal,1,AT("-",uVal)-1))
   uVal := ALLTRIM(STRTRAN(uVal,CHR(34),""))

   RunShell( myhttpadr, uVal, .T. )
RETURN NIL

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 4:11 am
by Wolfgang Ciriack
DC_SpawnUrl() should do it.

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 5:05 am
by reganc
The :itemselected slot that Jimmy mentioned translates to the ITEMSELECTED clause on the DCBROWSE command. That also means a double click would be needed.

You could probably also do the same thing but for a single click by assigning a codeblock to the columns datarea lbclick callback but I haven't tried that.

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 7:45 am
by rdonnay
I recommend that you also use the ITEMSELECTED clause to call DC_SpawnUrl().

If you MUST do this on one click, then you interfere with the navigation system of the DC_XbpBrowse() class.
It is possible to do this, but you will not like the results.

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 10:53 am
by Eugene Lutsenko
For some reason I immediately imagined what it must be like to make the background color of the column. Only instead of the COLOR should be like a HYPERLINK:

Code: Select all

DCBROWSECOL FIELD WebAppls->Appl_Name HEADER "Наименование приложения" PARENT WebAppls FONT "9.Courier" WIDTH 45 PROTECT {|| .T. } COLOR {||{nil,aColor[153]}}                            
[/size]

But how to access the field value when it is clicked?
DCBROWSECOL .... ACTION {||DC_SpawnUrl(???)}

PS
Of course it would be convenient if it worked in one click, as usual with hyperlinks

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 12:26 pm
by rdonnay
I will write you a sample program on how to do this.

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 12:51 pm
by Eugene Lutsenko
rdonnay wrote:I will write you a sample program on how to do this.
Great! Thank you in advance!

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 3:21 pm
by rdonnay
It will save me time if you give me your database.

Re: The current hyperlink from the table

Posted: Tue Jan 31, 2017 8:37 pm
by Eugene Lutsenko
rdonnay wrote:It will save me time if you give me your database.
Here it is