Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

changing styles of input fields

delphi

  • Please log in to reply
20 replies to this topic

#13 davidbrook

davidbrook

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 13 March 2011 - 12:12 PM

yeah, that is the exact same code that I have.

Just my problem is, that when I move from top to bottom over a few input fields fast with my mouse. It tends to keep some of them colored in. As if it hasn't seen the space inbetween the fields that is <>'INPUT'. I am getting the feeling that it is some sort of timer. This is just a minor detail, but it still looks a bit amateur. If you understand what I mean.
  • 0

#14 Zorfox

Zorfox

    CC Regular

  • Member
  • PipPipPip
  • 36 posts

Posted 13 March 2011 - 12:21 PM

I see what you're referring to. Yes, there is a time delay with any onMouse moves however small it may be. It is compunded by the speed you move the mouse because it has to process the code with each location. So if the CPU were uber fast a million Gigahertz (lol) you probably wouldn't notice it. For now, those microsecond delays will have to be good enough :). I don't think you will get any complaints that the field takes a few milliseconds to update if they drag it rapidly over two elements. If they do complain suggest they upgrade to a supercomuter named "HAL" lol.
  • 0

#15 davidbrook

davidbrook

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 13 March 2011 - 12:54 PM

hahaha, yeah well thats it then. I'm going to find myself HAL!
  • 0

#16 davidbrook

davidbrook

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 14 March 2011 - 10:16 AM

actually, I got a new error, maybe you get the same one?

this is the line that gives me the error:

element := htmlDoc1.parentWindow.event.srcElement;

and it is for this link only so far:

https://login.yahoo.com/config/login?.src=fpctx&.intl=nl&.pd=c%3D6T7evjap2e6CwWSb86QVdqk-&.done=http%3A%2F%2Fnl.yahoo.com%2F


just the login page for yahoo......

do you know how I can resolve this error?
  • 0

#17 Zorfox

Zorfox

    CC Regular

  • Member
  • PipPipPip
  • 36 posts

Posted 14 March 2011 - 02:09 PM

I don't get an error for Yahoo mail login, mail.yahoo.com. My statement does differ from yours however. element := htmlDoc1.parentWindow.event.srcElement; Mine uses HtmlDoc not HtmlDoc1. I attached the OnmouseOver event to the WebBrowser OnDocumentComplete. You will get an error if the Document is nil.

procedure TForm1.WebBrowser1DocumentComplete(ASender: TObject; const pDisp: IDispatch; var URL: OleVariant);
begin
  if Assigned(WebBrowser1.Document) then
  begin
    htmlDoc := WebBrowser1.Document as IHTMLDocument2;

    htmlDoc.onmouseover := (TEventObject.Create(Document_OnMouseOver) as IDispatch);
  end;
end; (*WebBrowser1DocumentComplete*)

Try adding error control for a blank document. I haven't looked through the code closely but I can only assume there is more error control that should be added as well. Is it an exception error or sprecific error?
  • 0

#18 davidbrook

davidbrook

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 15 March 2011 - 12:42 AM

yeah, it's odd, but it is only this webpage when I do it in the following manner. I go to yahoo.com then click on 'Sign in' and when I am on that page for the first time, it works fine. But when I right click and refresh it gives me the error 'Access violation....' yeah the htmldoc1 is fine, I asigned it properly. That shouldn't give me a problem. For some odd, reason this page gives me that error when I refresh it.
  • 0

#19 davidbrook

davidbrook

    CC Newcomer

  • Just Joined
  • PipPip
  • 13 posts

Posted 15 March 2011 - 01:52 AM

What also interesting is, that when I refresh, the coloring in of the fields does not work anymore..... odd, because I have it all under documentcomplete
  • 0

#20 Zorfox

Zorfox

    CC Regular

  • Member
  • PipPipPip
  • 36 posts

Posted 15 March 2011 - 04:21 PM

I'm not having the same problems. Apparently something else is going on I can't see. I sent you a PM so I can send you my source code for comparison. I didn't see a way to attach files and the project size exceeds the max character size. I'll have to email it to you. Sent you mine in a PM. I just don't understand what is going on without looking at your code. It may be a "OMG I didn't see that" problem...I have alot of those lol. Sometimes it helps to have someone else glance at your code with a new perspective to see those pesky problems we all overlook a hundred times.
  • 0

#21 Zorfox

Zorfox

    CC Regular

  • Member
  • PipPipPip
  • 36 posts

Posted 16 March 2011 - 02:08 PM

When a user refreshes a webpage the document changes. If we use the OnDocumentComplete event to run code blocks, the same code will not fire when the user refreshes the page. Depending on the page source, the document will change and these changes will need to be addressed. Since the TWebBrowser does not expose the OnRefresh function we can use the CommandStateChanged function for the WebBrowser. Add the same code for the DocumentComplete function to this event. This will fire the same code in the event the end user refreshes the page. The other alternative is to expose the OnRefresh event which may be needed depending on the problem encountered. However, for this error CommandStateChanged will suffice.
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download