scroll to right location when account is expanded

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@172 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1997-11-28 08:55:18 +00:00
parent 243464af30
commit 6f2d330f1c

View File

@ -300,6 +300,7 @@ expandListCB( Widget mw, XtPointer pClientData, XtPointer cb)
{
XmAnyCallbackStruct *info = (XmAnyCallbackStruct *) cb;
Account *acc = (Account *)pClientData;
int i, nrows;
/* a "fix" to avoid double invocation */
switch ( info->reason ) {
@ -330,8 +331,28 @@ expandListCB( Widget mw, XtPointer pClientData, XtPointer cb)
NULL);
}
/* finally, redraw the main window */
/* redraw the main window */
refreshMainWindow ();
/* find the selected account in the new window,
* and scroll to it. */
XtVaGetValues( accountlist, XmNrows, &nrows, NULL );
for (i=0; i<nrows; i++) {
Account * racc;
racc = (Account *) XbaeMatrixGetRowUserData (accountlist, i);
if (racc == acc) {
Boolean isviz;
isviz = XbaeMatrixIsRowVisible (accountlist, i);
if (False == isviz) {
/* scroll to bottom first, so that during rewind,
* sub-accounts become visible too */
XbaeMatrixMakeCellVisible (accountlist, nrows-1, 0);
XbaeMatrixMakeCellVisible (accountlist, i, 0);
}
break;
}
}
}
/********************************************************************\