Hi Andras,
On Sun, May 6, 2012 at 10:34 PM, Andras Timar <timar74@gmail.com> wrote:
Fortunately the tree control under Windows can receive
a message that does the sort, so everything can be solved with pure
Windows API calls.
http://cgit.freedesktop.org/libreoffice/core/commit/?id=39bb77fd667f9d9fdaf374f3934b6eec7b7dc57a
The Windows code looks OK, but there's no error control anywhere and
that makes me shiver.
I know in theory it shouldn't fail, but I would prefer to use an error
logging mechaninsm instead of letting it crash. This is just a sketch,
not real code.
BOOL bDidItWork = FALSE;
HWND hwndMSI = FindWindow(TEXT("MsiDialogCloseClass"), NULL);
if (hwdMSI) {
HWND hwndTV = FindWindowEx(hwndMSI, NULL, TEXT("SysTreeView32"), NULL);
if (hwndTV)
{
HTREEITEM treeRoot = TreeView_GetRoot(hwndTV);
if (treeRoot)
{
HTREEITEM optional = TreeView_GetNextSibling(hwndTV, treeRoot);
if (optional)
{
HTREEITEM dicts = TreeView_GetChild(hwndTV, optional);
if ( dicts)
{
TreeView_SortChildren(hwndTV, dicts, TRUE);
HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional);
if (langs)
{
TreeView_SortChildren(hwndTV, langs, TRUE);
bDidItWork = TRUE;
}
}
}
}
}
if (!bDidItWork) MessageBox(NULL, L"Error", L"Something is wrong. Call
the ghostbusters!");
or even a more controversial version:
HWND hwndMSI = FindWindow(TEXT("MsiDialogCloseClass"), NULL);
if(!hwndMSI) goto error;
HWND hwndTV = FindWindowEx(hwndMSI, NULL, TEXT("SysTreeView32"), NULL);
if(!hwndTV) goto error;
HTREEITEM treeRoot = TreeView_GetRoot(hwndTV);
if(!treeRoot) goto error;
HTREEITEM optional = TreeView_GetNextSibling(hwndTV, treeRoot);
if(!optional) goto error;
HTREEITEM dicts = TreeView_GetChild(hwndTV, optional);
if(!dicts) goto error;
TreeView_SortChildren(hwndTV, dicts, TRUE);
HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional);
if(!langs) goto error;
TreeView_SortChildren(hwndTV, langs, TRUE);
return TRUE;
error:
MessageBox(NULL, L"Error", L"Something is wrong. Call the ghostbusters!");
--
Jesús Corrius <jesus@softcatala.org>
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.