Ensures that the specified item is visible within the control, scrolling the contents of the control if necessary.
Ensures that the specified cell is visible within the grid control, scrolling the grid if necessary.
App.ActiveForm.DataGridObject.EnsureVisible(RowIndex, ColIndex)
Newlook Smartclient only.
RowIndex - (Integer, Required)
The index of the cell's row. The rows collection uses a zero-based index.
ColIndex - (Integer, Required for data grid control)
The index of the cell's column. The columns collection uses a zero-based index.
Returns a Boolean value for the DataGrid control. The method returns False if an invalid row/column is specified, otherwise it will always return True.
The following example ensures that the first column of the last row of a datagrid control is visible.
function EnsureLastRowVisible()
{
//determine what the row count is
initialRowCount = App.ActiveForm.TestGrid.RowCount;
//Set method to scroll grid so that the first cell of the last row is visible.
EnsureVisibleSuccess = App.ActiveForm.TestGrid.EnsureVisible (initialRowCount-1, 0);
//Store the return value as a Newlook variable
App.SetValue("vEnsureVisibleSuccess", EnsureVisibleSuccess);
}
Ensures that the specified list item is visible within the control, scrolling the list view if necessary.
App.ActiveForm.ListViewobject.EnsureVisible(Index as Integer[, ColumnIndex as Integer])
Newlook Smartclient only.
Index - (Integer, Required for the ListView control)
The index of the list item for the list view control.
ColumnIndex - (Integer, Required for the ListView control)
The index of the column in which the item is located. Use this argument if you wish to ensure that a certain sub item is visible.
This method does not return a value for the ListView control.
The following example returns the index of the first item with a Text property that matches the string specified by the user in the text box named txtString, and if found, selects the item and ensures that it is visible in the listview.
function ReturnIndex()
{
vSearchString = App.ActiveForm.txtString.Text;
vMatchType = App.ActiveForm.cmbMatchType.Text;
vStartIndex = App.ActiveForm.txtStartIndex.Text;
vPartial = App.ActiveForm.cmbPartial.Text;
vFoundItemIndex = App.ActiveForm.lvwGroceries.FindItem(vSearchString,vMatchType,vStartIndex,vPartial);
if (vFoundItemIndex >= 0)
{
App.ActiveForm.lvwGroceries.EnsureVisible(vFoundItemIndex,0);
App.ActiveForm.lvwGroceries.ListItems(vFoundItemIndex).Selected = true;
}
}
Ensures that the specified node is visible within the control, scrolling the tree view control if necessary.
App.ActiveForm.TreeViewObject.EnsureVisible(Node as Object)
Newlook Smartclient only.
Node - (Object, Required for the TreeView control)
This method takes a node object (or the node's Key).
This method does not return a value for the tree view control.
The following example ensures that the sixth node is visible in the control:
function MakeCFONodeVisible()
{
//Expand tree view control so that the CFO node is visible.
App.ActiveForm.tvOrgChart.EnsureVisible(App.ActiveForm.tvOrgChart.Nodes(5));
}
The following code will add three levels of Nodes to an empty TreeView control then expand the control so that the last node added is visible:
function AddNodes()
{
//Add the top-level node
nodeCEO = App.ActiveForm.tvOrgChart.Nodes.Add ("CEO", 0, 0, null, null,"nT1");
//Add the second tier of nodes
nodeCFO = App.ActiveForm.tvOrgChart.Nodes.Add ("CFO", 0, 0, "nT1", "First","nT21");
nodeCTO = App.ActiveForm.tvOrgChart.Nodes.Add ("CTO", 0, 0, nodeCEO, "Last", "nT22");
//Add the third tier of nodes
nodeTL31 = App.ActiveForm.tvOrgChart.Nodes.Add ("Accounts Team Lead", 0, 0, "nT21", "Child","TL31");
nodeTL32 = App.ActiveForm.tvOrgChart.Nodes.Add ("Admin Team Lead", 0, 0, nodeTL31, "Sibling", "TL32");
nodeTL33 = App.ActiveForm.tvOrgChart.Nodes.Add ("QA Team Lead", 0, 0, "nT22", "Sort","TL33");
nodeTL34 = App.ActiveForm.tvOrgChart.Nodes.Add ("Dev Team Lead", 0, 0, nodeCTO, "Sort", "TL34");
//Ensure that the control is expanded so that the last node is visible
App.ActiveForm.tvOrgChart.EnsureVisible ("TL34");
}
GetFirstVisibleColumn Method | GetFirstVisibleRow Method | GetFirstVisible Method
© 2004-2021 looksoftware. All rights reserved.