createhyperlink.bmx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. Strict
  2. Import MaxGUI.Drivers
  3. Import MaxGUI.ProxyGadgets
  4. AppTitle = "Hyperlink Test Window"
  5. Global wndMain:TGadget = CreateWindow( AppTitle, 100, 100, 300, 59, Null, WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS|WINDOW_STATUS )
  6. 'Standard Hyperlink Gadget
  7. Global hypLeft:TGadget = CreateHyperlink( "http://www.google.com/", 2, 2, ClientWidth(wndMain)-4, 15, wndMain, LABEL_LEFT )
  8. 'Center Aligned Hyperlink Gadget with alternate text
  9. Global hypCenter:TGadget = CreateHyperlink( "http://www.blitzbasic.com/", 2, 21, ClientWidth(wndMain)-4, 17, wndMain, LABEL_CENTER|LABEL_FRAME, "BlitzBasic" )
  10. 'Right Aligned Sunken Hyperlink Gadget with custom rollover colors set
  11. Global hypRight:TGadget = CreateHyperlink( "http://www.blitzmax.com/", 2, 42, ClientWidth(wndMain)-4, 15, wndMain, LABEL_RIGHT, "Custom Rollover Colors" )
  12. SetGadgetTextColor(hypRight,128,128,128) 'Set normal text color to grey.
  13. SetGadgetColor(hypRight,255,128,0) 'Set rollover color to orange.
  14. 'Example of how to retrieve a hyperlink gadget's URL
  15. Print "Hyperlink 1 URL: " + String(GadgetExtra(hypLeft))
  16. Print "Hyperlink 2 URL: " + String(GadgetExtra(hypCenter))
  17. Print "Hyperlink 3 URL: " + String(GadgetExtra(hypRight))
  18. 'Example of how to set a hyperlink gadget's URL
  19. SetGadgetExtra( hypRight, "http://www.blitzbasic.co.nz" )
  20. 'We need to update the tooltip to the new URL
  21. SetGadgetToolTip( hypRight, String(GadgetExtra(hypRight)) )
  22. Repeat
  23. WaitEvent()
  24. SetStatusText wndMain, CurrentEvent.ToString()
  25. Select EventID()
  26. Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE;End
  27. EndSelect
  28. Forever