public ElementProperties(FramedElement fe) { // // Required for Windows Form Designer support // InitializeComponent(); tboxElementHtml.Text = fe.e.outerHTML; grid.SelectedObject = new ElementProperty(fe); }
public ElementProperty(FramedElement fe) { bboxRect = (fe.e as IHTMLElement2).getBoundingClientRect(); this.fe = fe; }
private void screenPanel_MouseMove(object sender, MouseEventArgs e) { FramedElement item = screenPanel.FindElement(e.X, e.Y); if ( (item == null) || (item.e==null) || (item.e==preItem) ) { return; } preItem = item.e; screenPanel.ShowFlushMarker(item); focusedElement = item; if ( item.e != null ) { SetStatusFocusedItem(); } if ( (item.e != null) && (item.e.tagName == "INPUT") ) { IHTMLInputElement e2 = item.e as IHTMLInputElement; if ( e2 != null ) { if ( (e2.type=="text") || (e2.type=="password") ) { this.browserMain.Focus(); (e2 as IHTMLElement2).focus(); } } } }
private void ClearSelection() { selectedElement = null; focusedElement = null; }
private void SetSelectedElement(FramedElement fe) { selectedElement = fe; PageElement pe = PageElement.ToPageElement(fe.e); if ( pe == null ) { return; } if ( fe.IsInFrame ) { selectedDoc = fe.ContentWindow.document; } else { selectedDoc = browserMain.Document as IHTMLDocument2; } screenPanel.ShowSelectMarker(fe); ClearSnipConditional(); StringBuilder strBuilder = new StringBuilder(); if ( cbAssertSnip.Checked || cbActionSnip.Checked ) { IHTMLDocument2 doc2 = browserMain.Document as IHTMLDocument2; strBuilder = InsertSnipList(strBuilder, Frameset.GetFramesetSnip(doc2, SelectedDoc) ); } if ( cbAssertSnip.Checked ) { strBuilder = InsertSnipList( strBuilder, pe.AssertSnipList() ); } if ( cbActionSnip.Checked ) { pe.ClearSnipList(); strBuilder = InsertSnipList(strBuilder, pe.ActionSnipList()); } if ( strBuilder.Length > 0 ) { string newSnip = strBuilder.ToString(); InsertSnip( newSnip ); AppLogger.Write( newSnip ); } if ( Root.appConfig.simulationMode ) { if ( pe is InputText ) { btnTestSnip_Click(null, null); this.browserMain.Focus(); (fe.e as IHTMLElement2).focus(); } else if ( pe is SelectOption) { ; } else { btnTestSnip_Click(null, null); } } }
public void Reset() { selectItem = null; flushItem = null; try { MainForm.Browser.Parent.Refresh(); } catch (Exception) { } }
public void ShowFlushMarker(FramedElement item) { flushItem = item; MainForm.Browser.Parent.Refresh(); }
public void ShowSelectMarker(FramedElement item) { selectItem = item; MainForm.Browser.Parent.Refresh(); }
public Position GetClientPosition(FramedElement fe) { IHTMLElement2 e2 = fe.e as IHTMLElement2; IHTMLRect rect; if ( e2 != null ) { rect = e2.getBoundingClientRect(); } else { return null; } int fw = Root.appConfig.focusFrameWidth; float width = rect.right-rect.left+fw; float height = rect.bottom-rect.top+fw; rect.left -= fw+1; rect.top -= fw+1; rect.left += (int)(fw/2.0); // REVISIT: some fine adjustments. Check this rect.top += (int)(fw/2.0); // with the TableText.html page and different frame width if ( fe.IsInFrame ) { rect.left += fe.clientLeft; rect.top += fe.clientTop; } if ( e2 is HTMLAreaElementClass ) { // // the bounding box for area element is relative to // the map image's original, we have add the offset here // HTMLAreaElementClass e3 = e2 as HTMLAreaElementClass; HTMLMapElementClass map = e3.parentElement as HTMLMapElementClass; if ( (map != null) && (map.name!=null) ) { IHTMLElementCollection eList = (e3.ownerDocument as HTMLDocument).all.tags("IMG") as IHTMLElementCollection; IEnumerator it = eList.GetEnumerator(); string nameRef = "#" + map.name; while ( it.MoveNext() ) { HTMLImgClass img = it.Current as HTMLImgClass; if ( img.useMap == nameRef ) { IHTMLRect rectImg = img.getBoundingClientRect(); rect.top += rectImg.top + img.clientLeft; rect.left += rectImg.left + img.clientTop; } } } } return new Position(rect.left, rect.top, width, height); }