Jump to content

Disable MenuItem until selecting ListViewItem


Recommended Posts

Hello, how can i disable the GuiCtrlCreateMenuItem until it selects an item in the ListView

 

Here, how to keep ($lvitem) disabled/un-clickable until it select the (test) or any item in the ListView?

GuiCreate("")
$Listv=guictrlcreatelistview("test|testt|testtt",8,8,50,50,-1)
$menu=Guictrlcreatecontextmenu($listv)
$lvitem=guictrlcreatemenuitem("test", $menu)

Guictrlcreatelistviewitem("item1|bla|bla", $Listv)

Any help would be appreciated. :)

Link to comment
Share on other sites

9 minutes ago, AutoBert said:

You can use GuiCtrlSetState. Make a full runable reproducer script if you need more help.

I do using it, but how to Enable the menu item when i try to select an ListViewItem ??

 

Sorry i just can't write the full script now as i post from my phone.

Link to comment
Share on other sites

sample from one of my script (can probably help u) :

While 1

    $Selected = _GUICtrlListView_GetNextItem($ListView)

    If $ListView <> 0 Then
        ;Item Selected
        Msgbox(0,"$Array_ListView[$Selected][0]",$Array_ListView[$Selected][0])
    Else
        ;No Item Selected
    EndIf

WEnd

 

Edited by Synapsee
code edited
Link to comment
Share on other sites

Just now, Synapsee said:

sample from one of my script (can probably help u) :

While 1

    $Selected = _GUICtrlListView_GetNextItem($ListView) + 1

    If $ListView <> 0 Then
        ;Item Selected
        Msgbox(0,"ListView[$Selected][0]",$ListView[$Selected][0])
    Else
        ;No Item Selected
    EndIf

WEnd

 

Is it ok to use UDF with built-in Commands?

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...