Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

In Delphi - I need to have a ListBox record the destination URL of the images I click

Posted on 2011-02-19
3
Medium Priority
?
555 Views
Last Modified: 2012-05-11
Thanks for reading

this image depicts the program I need to build:

http://img252.imageshack.us/img252/5069/clickclick.gif

A typical "website photo gallery" will contain thumbnail images which contain an HREF tag which points to the BIGGER version of that picture.

I need to be able to click on this thumbnail image, and have the URL appear in a listbox.

I would like the WebBrowser component to function in no other way. e.g. i don't want it to actually go to the bigger image when I click. I just need the destination URL.

Got any ideas?

Thanks!
0
Comment
Question by:bobbysdog
3 Comments
 
LVL 3

Expert Comment

by:maosalah
ID: 34935629
0
 
LVL 24

Accepted Solution

by:
jimyX earned 2000 total points
ID: 34935630
Having Button, WebBrowser and ListBox on the form add the following code:
The code of the WebBrowser is at "OnBeforeNavigate2" and "OnDocumentComplete":
var  //Global variable
  NavigateCompleted:Boolean=False;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Webbrowser1.Navigate('YourMainURL');
end;

procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject;
  const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
  Headers: OleVariant; var Cancel: WordBool);
begin
  if NavigateCompleted then
    begin
      ListBox1.Items.Add(URL);
      Cancel := true;
    end;
end;

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
  const pDisp: IDispatch; var URL: OleVariant);
begin
  NavigateCompleted := true;  // set it to false to be able to navigate other URLs
end;

Open in new window

Please note: to be able to navigate to other URLs you need to set the variable "NavigateCompleted" to False.
0
 

Author Closing Comment

by:bobbysdog
ID: 34935699
wow thanks this is awesome!!!!!!!!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question