Hjælp til browser.
Jeg fandt en guide til hvordna man kan lave sin egen browser. Der er bare et problem. JEg har fuldt alle de nederstående trin men min compiler siger der er noget galt.1. Start with a new application. Change the form\'s Name property to WebMain and the Caption property to EZ Web Browser.
2. Place a Panel component on the form and change its Align property to alTop and its Height property to 60. Clear the Caption property.
3. Place a ComboBox component on the panel. Move it near the top of the panel and make it as wide as the panel itself. Change the Name property to URLComboBox. Change the Text property to an URL of your choice (try http://www.turbopower.com). Double-click the Constraints property and change the AnchorHorz constraint to akStretch.
4. Place a StatusBar component on the form. It will automatically position itself at the bottom of the form. Change its Name property to StatusBar and its SimplePanel property to True.
5. Place an HTML control in the middle of the form. Change its Align property to alClient. The HTML control fills the screen. Change the Name property to HTML.
Now your form should look similar to the one shown in Figure BD.1. If your application doesn\'t look exactly like Figure BD.1, adjust as necessary or just leave it. (A little individuality isn\'t a bad thing, after all.)
At this point, you should save the project. Save the form as WebBrwsU.pas and the project as WebBrows.dpr. Now you\'ll add just enough functionality to make the browser do something useful.
FIGURE BD.1. Your new Web browser after the first steps.
6. Click on the URL combo box. Generate an event handler for the OnClick event. Type the following code in the event handler:
if URLComboBox.Text <> `\' then
HTML.RequestDoc(URLComboBox.Text);
The RequestDoc method loads the requested document after first checking that the combo box contains text.
7. Now generate an event handler for the OnKeyPress event. Type the following code in the event handler:
if Key = Char(VK_RETURN) then begin
Key := #0;
if URLComboBox.Text = `\' then
Exit;
URLComboBoxClick(Sender);
end;
This code first checks the Key parameter to see whether the Enter key was pressed. If so, it sets Key to 0 and calls the URLComboBoxTest method (created in step 6). Setting Key to 0 prevents the speaker from beeping when the Enter key is pressed. The call to the URLComboBoxClick method loads the URL into the Web browser.
8. Now compile and run the program. Type an URL in the combo box and press Enter. If you typed in a valid URL, the page will load in the HTML control.
Wow! A Web browser in 15 minutes! Notice that the browser acts like any other Web browser...well, sort of. You need to add a lot of functionality, but it\'s a start.
Det er det første af de to ting manden vil have man skal skrive af der er noget galt i.
Jeg får error i følgende linie:
if URLComboBox.Text = `' then
JEg er ikke sikker på det er den rigtige error message jeg her poster man det burde det være:
[Error] Unit1.pas(41): Undeclared identifier: 'Key'
Jeg håber MEGET der er nogen der kan hjælpe!
På forhånd tak!
