Page 1 of 2

Browser

Posted: Sat Jul 17, 2004 11:58 pm
by Dremth
Hey Im making a browser and Im actually on it right now typing this and i need some help..... How can I make it where when the page has loaded it displays something like page loaded in the status bar? Also as Im typing this I can see that I cant hit enter to go to the next line. Please help me fix this too. Here is the code:

Code: Select all

Procedure ResizeWebWindow()
  ResizeGadget(10, -1, -1, WindowWidth(), WindowHeight()-51)
  ResizeGadget(4, -1, -1, WindowWidth()-235, -1)
  ResizeGadget(5, WindowWidth()-27, 2, -1, -1)
  ResizeGadget(6, -1, -1, WindowWidth(), -1)
EndProcedure


Procedure SizeCallback(WindowID, Message, wParam, lParam)

  ReturnValue = #PB_ProcessPureBasicEvents
  
  If Message = #WM_SIZE 
    UpdateStatusBar(0)
    ResizeWebWindow()
    ReturnValue = 1
  EndIf
  
  ProcedureReturn  ReturnValue
EndProcedure


If OpenWindow(0, 0, 200, 640, 500, #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered, "BowWow Browser - Version 1.0")

  CreateStatusBar(0, WindowID())
    StatusBarText(0, 0, "BowWow Browser - Status: Idle", 0)
      
  CreateGadgetList(WindowID())
    ButtonGadget(1,   2, 2, 50, 25, "Back")
    ButtonGadget(2,  52, 2, 50, 25, "Next")
    ButtonGadget(3, 102, 2, 50, 25, "Stop")
    ButtonGadget(11, 152, 2, 50, 25, "Refresh")
  
    StringGadget(4, 205, 4, 0, 20, "about:blank")
    
    ButtonGadget(5, 0, 0, 25, 25, "Go")
    
    Frame3DGadget(6, 0, 30, 0, 2, "", 2) ; Nice little separator
  
    If WebGadget(10, 0, 31, 0, 0, "about:blank") = 0 : MessageRequester("Error", "ATL.dll not found. Please contact the BowWow Browser Support: Dremth@comcast.net", 0) : End : EndIf
    
  
  AddKeyboardShortcut(0, #PB_Shortcut_Return, 0)
  
  ResizeWebWindow()
  
  SetWindowCallback(@SizeCallback())
  
  Repeat
    Event = WaitWindowEvent()
    
    Select Event
      Case #PB_Event_Gadget
      
        Select EventGadgetID()
          Case 1
            SetGadgetState(10, #PB_Web_Back)
          
          Case 2
            SetGadgetState(10, #PB_Web_Forward)
          
          Case 3
            SetGadgetState(10, #PB_Web_Stop)
          
          Case 11
            SetGadgetState(10, #PB_Web_Refresh)
                      
          Case 6
            SetGadgetText(10, GetGadgetText(4))
            
        EndSelect      
      
      Case #PB_Event_Menu ; We only have one shortcut
        SetGadgetText(10, GetGadgetText(4))
        StatusBarText(0, 0, "BowWow Browser - Status: Loading", 0)
              
    EndSelect
      
  Until Event = #PB_Event_CloseWindow
   
EndIf
If you can please email me with your replys: Dremth@comcast.net Thank You

Posted: Sun Jul 18, 2004 12:17 am
by Dremth
Also when I click on a link it will show the same addres in the address bar. I need to know of a way to show whatever site's address that Im on in the address bar. But wait theres more... When I click the back button it will show part of the site that I was on and part of the site that Im going back to. PLEEEEEEASE HELP ME WITH THIS!!!! The first to help me and it works gets their name in the credits! Thats not a big deal but its the least I can do. THANKS FOR ALL YOUR HELP I HOPE I GET LOTS OF WORKING REPLYS!!!! Dremth@comcast.net :)

Posted: Sun Jul 18, 2004 12:27 am
by Dremth
GRRRRR SO MANY ERRORS THAT I DONT KNOW HOW TO FIX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Well... I also need to know why it only shows the title as what I made it in the code. It wont show the html's title. Also the tabs wont work. And if I havent already mentioned that when you hit enter like for a button on the webpage it will just load what you have in the address bar. Again: PLEASE HELP ME WITH THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Posted: Sun Jul 18, 2004 1:42 am
by Beach
I'm not the guru you are hoping for - but I do know that the WebGadget is somewhat limited natively. You can extend the functionality of the WebGadget by using IWebBrowser2 discussed here in this thread:

viewtopic.php?p=35682

Good luck!

Posted: Sun Jul 18, 2004 1:45 am
by Proteus
Dremth wrote:GRRRRR SO MANY ERRORS THAT I DONT KNOW HOW TO FIX!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Well... I also need to know why it only shows the title as what I made it in the code. It wont show the html's title. Also the tabs wont work. And if I havent already mentioned that when you hit enter like for a button on the webpage it will just load what you have in the address bar. Again: PLEASE HELP ME WITH THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
For the Enter, you'll have to check if the gadget with the address is active. If it isn't, don't process the Enter. You'll have to set the window title manually.
There is a snippet somewhere in this forum that shows how to detect that the page finished loading.

Oh, and using CAPITAL and exlamation marks!!!!!!!!!! only annoys people. Often they'll just skip to the next thread.

Posted: Sun Jul 18, 2004 2:03 am
by GeoTrail
Love your signature Proteus :lol:
Whish I had that on a t-shirt :lol:

Re: Browser

Posted: Sun Jul 18, 2004 2:38 am
by NoahPhense

Code: Select all

; Sparkie 2004
;
#READYSTATE_UNINITIALIZED = 0 
; The control is waiting to be initialized 

#READYSTATE_LOADING = 1 
; The control is initializing itself through 
; one Or more asynchronous properties. Some 
; property values might not be available. 

#READYSTATE_LOADED = 2 
; The control has returned from IPersist*::Load 
; so that all its properties are available And 
; it has started any asynchronous Data transfers. 
; The control's properties are available and it is 
; ready To draw at least something through IViewObject::draw. 
; Making properties available doesn't necessarily require 
; The control's type information. 

#READYSTATE_INTERACTIVE = 3 
; The control is capable of interacting with the user in at 
; least some limited sense And can supply its type information. 
; Full interaction may not be available Until all asynchronous 
; Data arrives 

#READYSTATE_COMPLETE = 4 
; The control is completely ready for all requests. 

If OpenWindow(0, 10, 10, 700, 500, #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "WebGadget ReadyState") 

  If CreateStatusBar(0, WindowID()) 
    StatusBarText(0, 0, "") 
  EndIf 
      
  If CreateGadgetList(WindowID()) 
    WebGadget(0, 10, 10, 680, 460, "http://www.purebasic.com") 
    WebObject.IWebBrowser2 = GetWindowLong_(GadgetID(0), #GWL_USERDATA) ; needed for accessing IWebBrowser interface 
  EndIf 
  
EndIf 

Repeat 

  Event = WaitWindowEvent() 
  
  If isBusy 
    WebObject\get_ReadyState(@isReady) 
      
      Select isReady 
        Case 1 
          StatusBarText(0, 0, "Page Loading") 
        Case 2 
          StatusBarText(0, 0, "Page Loaded") 
        Case 3 
          StatusBarText(0, 0, "Page is interactive with some data missing") 
        Case 4 
          StatusBarText(0, 0, "Page finished loading") 
      EndSelect 
  EndIf 
  
  WebObject\get_busy(@isBusy) 
  
Until Event = #PB_Event_CloseWindow 
    
End 
- np

Posted: Sun Jul 18, 2004 10:35 am
by Proteus
GeoTrail wrote:Love your signature Proteus :lol:
Whish I had that on a t-shirt :lol:
With the right printer, that shouldn't be too difficult to do. :P

Re: Browser

Posted: Sun Jul 18, 2004 1:55 pm
by Dremth
what is that code for NoahPhense? the loading thing it looks like :)

Re: Browser

Posted: Sun Jul 18, 2004 3:53 pm
by NoahPhense
Dremth wrote:what is that code for NoahPhense? the loading thing it looks like :)
It gives good status..

- np

Posted: Sun Jul 18, 2004 5:43 pm
by Dremth
oh ok. umm... for the IWebBrowser2 thing it says something like structure not found or something. what should i do?

..

Posted: Sun Jul 18, 2004 5:55 pm
by NoahPhense
Dremth wrote:oh ok. umm... for the IWebBrowser2 thing it says something like structure not found or something. what should i do?
What version of PB are you using?

- np

Posted: Sun Jul 18, 2004 6:00 pm
by thefool
Also thought about that. Sure you are using 3.91?

Posted: Mon Jul 19, 2004 1:28 am
by Dremth
mmmm...... 3.91? uhh dont think so.... 3.90...... but also i dont have the registered version... its just the demo.... I only need 5 more dollars!! 8O

Posted: Mon Jul 19, 2004 9:56 am
by thefool
i belive you need the registered version, because its uses api stuff.