Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/BrowserRecord.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by h677, Sun Nov 27 15:51:34 2005 UTC revision 1.2 by h677, Sun Nov 27 16:40:05 2005 UTC
# Line 30  type Line 30  type
30                  property        LastSize        : Integer               read FLastSize  write FLastSize;                  property        LastSize        : Integer               read FLastSize  write FLastSize;
31                  property        Repaint         : Boolean               read FRepaint   write FRepaint;                  property        Repaint         : Boolean               read FRepaint   write FRepaint;
32                  property        Movement        : string                read FMovement  write FMovement;                  property        Movement        : string                read FMovement  write FMovement;
33                    procedure       Move(const AName: string);
34                    procedure       IDAnchorPopup(Abody :string);
35          end;          end;
36          // BrowserRecordについているFBrowserを外す          // BrowserRecordについているFBrowserを外す
37          procedure ReleaseBrowser( BRecord: TBrowserRecord);          procedure ReleaseBrowser( BRecord: TBrowserRecord);
38    
39  implementation  implementation
40    
41    uses
42            Forms, SysUtils;
43    
44  // *************************************************************************  // *************************************************************************
45  //! BrowserRecordについているFBrowserを外す  //! BrowserRecordについているFBrowserを外す
46  // *************************************************************************  // *************************************************************************
# Line 67  begin Line 73  begin
73                                  Self.Thread.ScrollTop := doc.Body.ScrollTop;                                  Self.Thread.ScrollTop := doc.Body.ScrollTop;
74                          end;                          end;
75                  end;                  end;
                 //TOleControl(Self.FBrowser).Visible := false;  
76                  ShowWindow(Self.FBrowser.Handle, SW_HIDE);                  ShowWindow(Self.FBrowser.Handle, SW_HIDE);
77          end;          end;
78    
79  end;  end;
80    // *************************************************************************
81    //! ブラウザをスクロールさせる
82    // *************************************************************************
83    procedure TBrowserRecord.Move(const AName: string);
84    var
85            top: Integer;
86            item: OleVariant;
87    begin
88            //ブラウザが付いてるときだけ処理する
89            if (Self.Browser <> nil) then begin
90                    //ブラウザがデータの読み込み中の時は読み込みを待つ
91                    while (Self.Browser.ReadyState <> READYSTATE_COMPLETE) and
92                                            (Self.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
93                            Sleep(1);
94                            Application.ProcessMessages;
95                    end;
96    
97                    try
98                            top := 0;
99                            item := OleVariant( Self.Browser.Document as IHTMLDocument2)
100                                            .anchors.item(OleVariant(AName));
101                            item.focus();
102                            repeat
103                                    top := top + item.offsetTop;
104                                    item := item.offsetParent;
105                            until AnsiCompareText(item.tagName, 'body' ) = 0;
106                            OleVariant(Self.Browser.Document as IHTMLDocument2).body.scrollTop := top;
107                    except
108                    end;
109            end;
110    end;
111    //IDアンカー追加
112    procedure TBrowserRecord.IDAnchorPopup(Abody :string);
113    const
114            OUTER_HTML = '<p id="idSearch"></p>';
115            HIDDEN = 'hidden';
116    var
117            firstElement: IHTMLElement;
118            document: IHTMLDocument2;
119            docAll: IHTMLElementCollection;
120            doc : Variant;
121            nCSS : string;
122    begin
123            if Self.Browser <> nil then begin
124                    try
125                            document := Self.Browser.Document as IHTMLDocument2;
126    
127                            if Assigned(document) then begin
128                                    docAll := document.all;
129                                    firstElement := docAll.item('idSearch', 0) as IHTMLElement;
130                                    if (Assigned(firstElement)) then begin
131                                            if Length(Abody) > 0 then begin
132                                                    doc := Idispatch( olevariant(Self.Browser.ControlInterface).Document) as IHTMLDocument2;
133                                                    nCSS := '<p id="idSearch" style="position:absolute;top:' + IntToStr(doc.Body.ScrollTop + 10) + 'px;right:5px;' //
134                                                            + 'background-color:window; border:outset 1px infobackground; z-index:10; overflow-y:auto; border-top:none">'
135                                                            + Abody + '</p>';
136                                                    firstElement.outerHTML := nCSS;
137                                                    firstElement.style.visibility := 'visible';
138                                            end else begin
139                                                    firstElement.outerHTML := OUTER_HTML;
140                                                    firstElement.style.visibility := HIDDEN;
141                                            end;
142                                    end else if (Assigned(firstElement)) then begin
143                                            firstElement.outerHTML := OUTER_HTML;
144                                            firstElement.style.visibility := HIDDEN;
145                                    end;
146                            end;
147                    except
148                    end;
149            end;
150    end;
151    
152    
153  end.  end.

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26