IonicWind Software

IWBasic => General Questions => Topic started by: Brian on November 20, 2014, 01:00:26 PM

Title: Hyperlinks
Post by: Brian on November 20, 2014, 01:00:26 PM
Evening,

I'd like to put a couple of hyperlinks in a dialog box. Is there an easy enough way to do it?
I have had a look through my hundreds of files, and can't see anything

Thanks,

Brian
Title: Re: Hyperlinks
Post by: LarryMc on November 20, 2014, 01:37:39 PM
/*'==================================================================================================
HyperLink Example
'==================================================================================================*/
$include "windowssdk.inc"
dialog about


int sh,cid,chng
CREATEDIALOG about,0,0,300,260,0x80C00080,0,"About",&Do_About
CONTROL about,@STATIC,"IWBasic Version 2.0",14,170,274,14,0x50000101,11
CONTROL about,@BUTTON,"OK",120,225,60,20,0x50010001,20
domodal about

global SUB Do_About(),int
SELECT @CLASS
CASE @IDINITDIALOG
CENTERWINDOW about
SETCONTROLCOLOR about,20,RGB(0,0,0),RGB(0,192,192)
        SetControlColor about,11,0xFF0000,Getsyscolor(15)
cid=0:chng=0
      sh = GetControlHandle(about,11)
CASE @IDCONTROL
SELECT @CONTROLID
case 11
if @notifycode=0
System "http://www.ionicwind.com/"
SendMessage (about,WM_SetCursor,0,sh)
endif
CASE 20
if @notifycode=0
CLOSEDIALOG about,@IDOK
endif
ENDSELECT
  Case WM_SetCursor
      cid = GetDlgCtrlID(@Code)
if (cid = 11) AND (chng = 0)
SetFont about,"",8,400,@SFUnderLine,11
SetControlColor about,11,0x0000FF,Getsyscolor(15)
chng = 1
Else
If (cid <> 11)AND (chng = 1)
SetFont about,"",8,400,0,11 
SetControlColor about,11,0xFF0000,Getsyscolor(15)
chng = 0
EndIf
endif
ENDSELECT
RETURN 0
ENDSUB
Title: Re: Hyperlinks
Post by: Brian on November 20, 2014, 03:32:57 PM
Great! Fitted and working

Thanks, Larry

BTW: How are you feeling?
Title: Re: Hyperlinks
Post by: LarryMc on November 20, 2014, 05:07:55 PM
Thanks for asking.
Still sore. Got 14 of my 28 staples out yesterday but the rest weren't ready. Bile is still coming out of my drain.  I have an extra bile duct that is leaking.  Just got back from scheduling another procedure for this coming Tuesday.  They going to go in through my mouth and put a stent in the main bile duct to block off the one that is leaking.
Best case is I come home same day.  Worse case is they have to cut me open again.

At least I'm not staring at grass roots everyday. ;D ;D
But I am pretty weak right now; so I check the forums in spurts.
Title: Re: Hyperlinks
Post by: Brian on November 22, 2014, 04:17:15 AM
Abort, abort! I have fixed the focus problem by having two variables - chng1 and chng2,
instead of the single chng. Works OK now

Larry,

Am I doing it right? I have two hyperlinks that I want to select from in my dialog box,
and I notice that it doesn't always relinquish the focus from one to the other

Here's the code:

INT sh1,sh2,cid,chng
ISTRING theYear[5],theMonth[4]

SUB HelpDlg(),INT
   SELECT @CLASS
CASE @IDINITDIALOG
   CENTERWINDOW help
   SETFONT help,"MS Sans Serif",8,700,0,20
   SETCONTROLCOLOR help,20,RGB(255,255,255),RGB(32,37,138)
   SETCONTROLCOLOR help,22,0xFF0000,GetSysColor(15)
   SETCONTROLCOLOR help,24,0xFF0000,GetSysColor(15)
   cid=0
   chng=0
   sh1=GETCONTROLHANDLE(help,22)
   sh2=GETCONTROLHANDLE(help,24)
   theMonth=MID$(DATE$("ddd',' MMM dd yyyy"),6,3)
   theYear=MID$(DATE$("ddd',' MMM dd yyyy"),13,4)
CASE @IDCONTROL
   SELECT @CONTROLID
CASE 22
   SYSTEM "e:\\Compilers"
'   SYSTEM "Q:\\Archive"
   SENDMESSAGE(help,WM_SETCURSOR,0,sh1)
CASE 24
   SYSTEM "e:\\Downloads"
'   SYSTEM "K:\\MemberDatabaseFolders\\Letters\\Data\\AF\\"+theYear+"\\"+theMonth
   SENDMESSAGE(help,WM_SETCURSOR,0,sh2)
CASE 30
IF @NOTIFYCODE=0
   CLOSEDIALOG help,@IDOK
ENDIF
ENDSELECT
CASE WM_SETCURSOR
   cid=GetDlgCtrlID(@CODE)
IF (cid=22) AND (chng=0)
   SETFONT help,"",8,400,@SFUNDERLINE,22
   SETCONTROLCOLOR help,22,0x008000,GetSysColor(15)
   chng=1
ELSE
IF (cid<>22) AND (chng=1)
   SETFONT help,"",8,400,0,22
   SETCONTROLCOLOR help,22,0xFF0000,GetSysColor(15)
   chng=0
ENDIF
ENDIF
IF (cid=24) AND (chng=0)
   SETFONT help,"",8,400,@SFUNDERLINE,24
   SETCONTROLCOLOR help,24,0x008000,GetSysColor(15)
   chng=1
ELSE
IF (cid<>24) AND (chng=1)
   SETFONT help,"",8,400,0,24
   SETCONTROLCOLOR help,24,0xFF0000,GetSysColor(15)
   chng=0
ENDIF
ENDIF
ENDSELECT
RETURN 0
ENDSUB