Browser

Just starting out? Need help? Post your questions and find answers here.
Dremth
User
User
Posts: 27
Joined: Sat Jul 10, 2004 5:24 pm
Location: My Computer
Contact:

Browser

Post 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
Dremth
User
User
Posts: 27
Joined: Sat Jul 10, 2004 5:24 pm
Location: My Computer
Contact:

Post 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 :)
Dremth
User
User
Posts: 27
Joined: Sat Jul 10, 2004 5:24 pm
Location: My Computer
Contact:

Post 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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post 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!
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post 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.
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Love your signature Proteus :lol:
Whish I had that on a t-shirt :lol:
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: Browser

Post 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
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post 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
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
Dremth
User
User
Posts: 27
Joined: Sat Jul 10, 2004 5:24 pm
Location: My Computer
Contact:

Re: Browser

Post by Dremth »

what is that code for NoahPhense? the loading thing it looks like :)
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: Browser

Post by NoahPhense »

Dremth wrote:what is that code for NoahPhense? the loading thing it looks like :)
It gives good status..

- np
Dremth
User
User
Posts: 27
Joined: Sat Jul 10, 2004 5:24 pm
Location: My Computer
Contact:

Post by Dremth »

oh ok. umm... for the IWebBrowser2 thing it says something like structure not found or something. what should i do?
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post 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
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Also thought about that. Sure you are using 3.91?
Dremth
User
User
Posts: 27
Joined: Sat Jul 10, 2004 5:24 pm
Location: My Computer
Contact:

Post 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
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

i belive you need the registered version, because its uses api stuff.
Post Reply