how to open url webpage by clicking an image?? i'm using macos x 10.13.6 and windows 10 ....
hi, i'm trying to launch a web page clicking on a credit image from my purebasic program...but without success ...can you help me please??
Best regards,Lestroso
(Solved)how to open url webpage by clicking an image??
(Solved)how to open url webpage by clicking an image??
Last edited by LESTROSO on Fri Jun 07, 2019 6:37 pm, edited 3 times in total.
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: how to open url webpage by clicking an image??
Code: Select all
EnableExplicit
CreateImage(1, 100, 100, 24, RGB(255, 0, 0))
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ImageGadget(1, 10, 10, 100, 100, ImageID(1), 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
RunProgram("https://www.google.de")
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
Code: Select all
EnableExplicit
CreateImage(1, 100, 100, 24, RGB(255, 0, 0))
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(1, 10, 10, 100, 100, 0)
If StartDrawing(CanvasOutput(1))
DrawImage(ImageID(1), 0, 0)
StopDrawing()
EndIf
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Select EventType()
Case #PB_EventType_LeftClick
RunProgram("https://www.google.de")
EndSelect
EndSelect
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
Re: how to open url webpage by clicking an image??
RSBasic's examples only work on Windows. On MacOS you have to useLESTROSO wrote:i'm using macos x 10.13.6 and windows 10 ....
Code: Select all
RunProgram("Open", "https://www.google.de", "")
Re: how to open url webpage by clicking an image??
I thank you very much!! it's all ok!! you have solved my problem....Best Regards, Lestroso
Re: how to open url webpage by clicking an image??
Dear friends...... i try to code this problem but i cant have success with it....My Simple problem is to click an image jpg and open the browser to google... i try this software..can you help me??? please ??? Lestroso
Code: Select all
Global FasaImage
Procedure testaimmagini()
Select EventGadget()
Case #Fasaimage
If EventType() = #PB_EventType_Change
Select GetGadgetState(#Fasaimage)
Case 1
Debug #fasaimage
RunProgram("Open", "https://www.google.com", "") ; this for macintosh
;version windows RunProgram("https://www.google.de", "")
EndSelect
EndIf
EndSelect
EndProcedure
Re: how to open url webpage by clicking an image??
It is best if you post a runnable program so that we can better see what you are trying to do. It's not clear what you're trying to do there - what type of gadget is #Fasaimage? Why do you check the EventGadget() in a procedure - is it bound to a gadget's event?
Re: how to open url webpage by clicking an image??
This should do it:LESTROSO wrote:...to click an image jpg and open the browser to google...
Code: Select all
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
If OpenWindow(0, 0, 0, 200, 200, "ImageGadget", wFlags)
yourImage = CreateImage(#PB_Any, 180, 180, 32, #Red)
imageGadget = ImageGadget(#PB_Any, 10, 10, 10, 10, ImageID(yourImage))
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
appQuit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case imageGadget
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
RunProgram("Open", "https://www.google.com", "")
CompilerElseIf #PB_Compiler_OS = #PB_OS_Windows
RunProgram("https://www.google.de")
CompilerEndIf
EndSelect
EndSelect
Until appQuit
EndIf
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! Please visit my YouTube Channel
Re: how to open url webpage by clicking an image??
Dear TI-994A,...your software example...clear my problem...i tryed your software and it works fine! I thank you very much...best regards, Lestroso