It is currently Wed Oct 28, 2020 10:12 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to make an image hyperlinked?
PostPosted: Thu May 22, 2014 3:56 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Jul 24, 2009 6:24 am
Posts: 172
Location: Malaysia
Hi hope you can help.

I need to be able to click an hyperlinked image?

what is the code to make the imagegadget hyperlinked?

Thanks for your help.

REgards
Alan


Top
 Profile  
Reply with quote  
 Post subject: Re: How to make an image hyperlinked?
PostPosted: Thu May 22, 2014 6:09 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2325
Location: Singapore
AlanFoo wrote:
...what is the code to make the imagegadget hyperlinked?

Hi Alan. Perhaps something like this:
Code:
UseJPEGImageDecoder()
InitNetwork()

Enumeration
  #MainWindow
  #WebWindow
  #HyperLink1
  #HyperLink2
  #HyperLink3
  #img1
  #img2
  #img3
EndEnumeration

ReceiveHTTPFile("https://www.dropbox.com/s/igu72odknllgcaf/purebasicLogo.jpg?dl=1",
                GetTemporaryDirectory() + "purebasicLogo.jpg")
imageFile.s = GetTemporaryDirectory() + "purebasicLogo.jpg"
LoadImage(#img1, imageFile)

ReceiveHTTPFile("https://www.dropbox.com/s/ewrlaf3vlobb0k0/googleLogo.jpg?dl=1",
                GetTemporaryDirectory() + "googleLogo.jpg")
imageFile.s = GetTemporaryDirectory() + "googleLogo.jpg"
LoadImage(#img2, imageFile)

ReceiveHTTPFile("https://www.dropbox.com/s/g0iite3ucfyy196/purebasicForum.jpg?dl=1",
                GetTemporaryDirectory() + "purebasicForum.jpg")
imageFile.s = GetTemporaryDirectory() + "purebasicForum.jpg"
LoadImage(#img3, imageFile)

wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
OpenWindow(#MainWindow, #PB_Any, #PB_Any, 700, 500, "Hyperlinked Images", wFlags)
WebGadget(#WebWindow, 10, 120, 680, 360, "http://www.purebasic.com")
ImageGadget(#HyperLink1, 10, 10, 200, 100, ImageID(#img1))
ImageGadget(#HyperLink2, 250, 10, 200, 100, ImageID(#img2))
ImageGadget(#HyperLink3, 490, 10, 200, 100, ImageID(#img3))

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      appQuit = 1
    Case #PB_Event_Gadget
      Select EventGadget()
        Case #HyperLink1
          Select EventType()
            Case #PB_EventType_LeftClick
              SetGadgetText(#WebWindow, "http://www.purebasic.com")
          EndSelect
        Case #HyperLink2
          Select EventType()
            Case #PB_EventType_LeftClick
              SetGadgetText(#WebWindow, "http://www.google.com")
          EndSelect
        Case #HyperLink3
          Select EventType()
            Case #PB_EventType_LeftClick
              SetGadgetText(#WebWindow, "http://www.purebasic.fr/english/viewtopic.php?p=445070#p445070")
          EndSelect
      EndSelect
  EndSelect
Until appQuit = 1
Hope it's what you're looking for. :D

EDITS wrote:
18th February 2019: updated download links

_________________
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!


Last edited by TI-994A on Mon Feb 18, 2019 6:25 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: How to make an image hyperlinked?
PostPosted: Thu May 22, 2014 9:25 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Jul 24, 2009 6:24 am
Posts: 172
Location: Malaysia
Hi Ti994A,

Thanks. That is what I am looking for.

regards
Alan


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye