Solved

Controlling TWebBrowser Page controls ?

Posted on 2008-10-03
2
283 Views
Last Modified: 2012-05-05
In code, how can I traverse a TWebBrowser's page and find a list control by its ID (LogBookPanel1_ddLogType) and select a item from the list?

thanks

 <select name="LogBookPanel1$ddLogType" id="LogBookPanel1_ddLogType">
<option selected="selected" value="-1">- Select One -</option>
<option value="13">Retrieve from WCMC</option>
<option value="19">Grab it from somewhere else</option>
<option value="4">Write note</option>
<option value="48">Discovered it</option>
<option value="-1">- Select One -</option>
</select>
0
Comment
Question by:geocoins-software
2 Comments
 
LVL 21

Expert Comment

by:ziolko
Comment Utility
not exactly what you looking for but there are code snippets how to access elements of web-page:
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_21372503.html
especially first comment by calinutz can be helpfull

ziolko.
0
 
LVL 5

Accepted Solution

by:
wd123 earned 250 total points
Comment Utility
as you wish =)
const html='<html><body><select name="LogBookPanel1$ddLogType" id="LogBookPanel1_ddLogType">'+

'<option selected="selected" value="-1">- Select One -</option>'+

'<option value="13">Retrieve from WCMC</option>'+

'<option value="19">Grab it from somewhere else</option>'+

'<option value="4">Write note</option>'+

'<option value="48">Discovered it</option>'+

'<option value="-1">- Select One -</option>'+

'</select></body></html>';

var el:OleVariant;

begin

WebBrowser1.Navigate('about:blank');

while WebBrowser1.ReadyState<>4 do begin Application.ProcessMessages;sleep(50);end; //wait

WebBrowser1.OleObject.document.write(html);//simulate page

el:=WebBrowser1.OleObject.document.getElementById('LogBookPanel1_ddLogType');

el.value:=4;//select 'Write note'

Open in new window

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now