Well I'm making a little browser and i wanth it to verify if enter has been pressed while the address bar is selected(so that it acts like go) but I can't seem to do it... I tryed with keyhit but nothing happened here is the code:
Global window = CreateWindow("Black browser",0,0,1024,800,0,15)
Global HTML = CreateHTMLView (0 , 100 , ClientWidth (window) , ClientHeight (window)-120 , window)
Global back_button:tgadget = CreateButton("Back" , 5 , 5 , 80 , 40 , window , button_push)
Global forward_button:tgadget = CreateButton("Forward",85,5,80,40,window,button_push)
Global URL:Tgadget = CreateTextField(5,50,200,20,window,0)
Global go:Tgadget = CreateButton("Go",210,50,30,20,window,button_push)
MaximizeWindow(window)
SetGadgetText( URL,"www.yahoo.com")
HtmlViewGo( HTML,"www.yahoo.com" )
Repeat
Select WaitEvent ()
Case EVENT_GADGETACTION
If EventSource() = back_button
HtmlViewBack( HTML )
End If
If EventSource() = forward_button
HtmlViewForward(HTML)
End If
If EventSource() = go
HtmlViewGo( HTML,TextFieldText( URL ) )
End If
Case EVENT_WINDOWCLOSE End
End Select
If KeyHit(key_enter)
HtmlViewGo( HTML,TextFieldText( URL ) )
End If
Forever
|