Hyperlink gadget that kind of works

BlitzMax Forums/MaxGUI Module/Hyperlink gadget that kind of works

JoshK(Posted 2008) [#1]
Don't know enough about MaxGUI to finish it.

Strict

Framework maxgui.win32maxgui
Import maxgui.drivers
Import brl.eventqueue

Local window:TGadget

window=CreateWindow("My Window",40,40,640,480)

Local h:TWindowsHyperlink=New TWindowsHyperlink
h.Create(window,0)
h.SetArea 4,4,640,18


While True
	WaitEvent 
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend


Type TWindowsHyperlink Extends TWindowsGadget
	
	Field _style
	
	Method Create:TWindowsHyperlink(group:TGadget,style)	
		Local	xstyle,wstyle,hotkey
		Local	hwnd,parent
		
		wstyle=WS_CHILD|SS_NOPREFIX|WS_CLIPSIBLINGS|SS_NOTIFY
		
		Select style&24
			Case LABEL_LEFT wstyle:|SS_LEFT
			Case LABEL_RIGHT wstyle:|SS_RIGHT
			Case LABEL_CENTER wstyle:|SS_CENTER
		End Select
		Select style&7
			Case LABEL_FRAME wstyle:|WS_BORDER
			Case LABEL_SUNKENFRAME wstyle:|SS_SUNKEN
			Case LABEL_SEPARATOR wstyle:|SS_ETCHEDFRAME
		End Select
		
		wstyle=WS_VISIBLE | WS_CHILD | WS_TABSTOP
		
		parent=group.query(QUERY_HWND_CLIENT)
		hwnd=CreateWindowExW(xstyle,"SysLink","<A HREF=~qhttp://www.leadwerks.com\~q>www.leadwerks.com</A> ",wstyle,0,0,0,0,parent,hotkey,GetModuleHandleW(Null),Null)
		
		_style = style
		
		Register GADGET_BUTTON,hwnd					
		
		Return Self
	EndMethod
	
	Method SetArea(x,y,w,h)
		If ((_style & 7) = LABEL_SEPARATOR) Then
			If (w > h) Then h = 4 Else w = 4
		EndIf
		Return Super.SetArea(x,y,w,h)
	EndMethod
	
	Method WndProc(hwnd,msg,wp,lp)
		Local nmhdr:Int Ptr
		Print msg+", "+WM_NOTIFY
		Select msg
			Case WM_ERASEBKGND;Return 1
			Case WM_NOTIFY
				Notify 1
				Local nmhdr:Int Ptr=Int Ptr(lp)
				Select nmhdr[2]
					Case NM_RETURN
						Notify 1
				EndSelect
		EndSelect	
	EndMethod
	
	Method Class()
		Return GADGET_BUTTON
	EndMethod
					
EndType



Ked(Posted 2008) [#2]
I thought we already had one? In maxgui.proxygadgets?


JoshK(Posted 2008) [#3]
What?!


Ked(Posted 2008) [#4]
Yep. We do. Just checked.

CreateHyperlink:TGadget( url$,x,y,w,h,group:TGadget,style=0,customtext$ = "" )


Be sure to import MaxGUI.ProxyGadgets.