Hi,
I'm building a "Server management console" in which the administrator can
see which users (clients) are logged-in and which actions they are taking.
Now my problem is the following;
For the logging of different info, i use datatables (e.g. a table for
"clients" one for "files open" one for "records locked" etc). When one of
the clients does something ( like logging-off, signing-in, opening a file..)
I alter the datatable (e.g datatable.row.delete). All these happenings get
processed ok, datatables are filled/altered correctly. My problem is in the
refreshing of the treeview/listview.
On top of the console i have some buttons, if you press one, i fill the
treeview with the data of one of the datatables, and depending on what node
is selected, I fill the listview in the same manner.
Ok imagine the following situation;
on the left the trieview with 2 users logged in, both with 2 files open.
Treeview shows "users"(parentnode) and "user1"& "user2" as two subnodes. I
select user2, listview shows two lines which shows info about the files
opened by user2. in the listview I select the second line.
I have a timer running which checkes every second which tree-/listview is
open (to know which datatables are used) and accordingly if any changes have
been made to the datatables that are displayed. All works like a
charm....When the management console has the focus.. and this is where my
problem sets in. I want the console to refresh also when it doesn't have the
focus. But i can't figure out how.
1.How do I know which nodes are selected
2.How do I "rebuild" the tree-/listview on the background (I rebuild like
this, which works fine with focus, tv.beginupdate, tv.clear,
tv.nodes.add....etc, tv.endupdate)
Hope someone can shed me some light on this issue.
If, after reading this, you think there is a better way of achieving what
i'm trying to achieve, pls let me know.
Thanks,
Albert R.
Software Engineer,
The Netherlands
Shell - 12 Aug 2004 09:46 GMT
Albert,
I have a question: why is your timer not working when your form doesn't
have focus? In my opinion, it should keep working fine. Are you getting
some sort of exception? Can you shed some more light on your
implementation? Perhaps you could post some sample code. Are you
building a MMC plugin, or is this a pure C# WinForms application?
Albert - 12 Aug 2004 10:58 GMT
I'm using VB.Net, it is a windows form handled by an application context.
The application starts when the server does. You will only see an icon in
the systray. When double-clicking this icon you will see the form.
The timer is working ok, don't have any problems with that.
Been looking into it a little bit more closely and I know how i can get it
to work if you can tell me how members of the tree-/listview can be kept
"selected" after the form loses focus. Take windows-explorer for example.
When you select a directory on the left, it'll become blue, when it loses
focus, it isn't blue anymore, but you can see it is still selected. This is
what im looking for.
The tree-/listview wasn't refreshing because the refresh trigger also uses
the node which is selected. (and none are selected when not focussed)
Albert
> Albert,
>
[quoted text clipped - 3 lines]
> implementation? Perhaps you could post some sample code. Are you
> building a MMC plugin, or is this a pure C# WinForms application?
Shell - 12 Aug 2004 12:10 GMT
Albert,
You could try changing the HideSelection property of the ListView and
TreeView to false. This will ensure that the selection remains selected
even when the control loses focus.
Hope that fixes it!
Albert - 12 Aug 2004 12:27 GMT
Thanks,
should have known it would be some kind of property. Sometimes when you're
looking at smt so long, you loose sight of the obvious.
> Albert,
>
[quoted text clipped - 3 lines]
>
> Hope that fixes it!