Jump to content

contextmenu in a EMPTY treeview


 Share

Recommended Posts

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

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...