Jump to content
Sign in to follow this  
UTA

contextmenu in a EMPTY treeview

Recommended Posts

UTA

I use the example of GaryFrost in THIS thread to open up a context menu when a treeview item is rightclicked. This menu contains also the possibility to add a new item. Everything works fine.

BUT:

I read the treeview-items dynamically from an INI-file and there could be the situation that no items are existing. Then it should be possible for the user to add a new item by opening up the contextmenu and choose "new item". But with this code above no contextmenu is apearing.

How can I do this?

UTA

Share this post


Link to post
Share on other sites
UTA

Bump!

Perhaps someone has an idea how to work around the task in a simple but clever way?

UTA

Share this post


Link to post
Share on other sites
martin

Bump!

Perhaps someone has an idea how to work around the task in a simple but clever way?

UTA

Just modify it somehow, nothing clever so that if no item for right click then do something else.

Case $event = $NM_RCLICK
                 If _GUICtrlTreeView_GetCount($TreeView) = 0 then
    ;call some special menu or whatever
    return 0
    endif
    ;rest as before
    Local Const $TVHT_NOWHERE = 1
    Local Const $T........

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
UTA

Just modify it somehow, nothing clever so that if no item for right click then do something else.

...

Absolutely perfect for my needs. To be honest, I tried exactly such a workaround already in this function. But obviously at the wrong line number (later) where it didn't work and I wondered why... so I despaired. Bu thank you it works now and I am happy!!!

Thank you!

UTA

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×