Jump to content

ContextMenu on Pics?


Recommended Posts

I'm trying to make a contextmenu on a picture (Guictrlcreatepic()), but when I right click it, the context menu doesn't show up. I tried making a context menu on a button, and that worked, and then all I did was change the button to a picture, and it was a no-go. Am I doing something wrong, or is this not possible?

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

Works for me..

$Gui = GUICreate(":-)", 120, 58)
$Pic = GUICtrlCreatePic(@WindowsDir & "\Blue Lace 16.bmp", 5, 5, 48, 48)
$Context0 = GUICtrlCreateContextMenu($Pic)
$Context1 = GUICtrlCreateMenuitem("Exit", $Context0)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $Context1
            Exit
    EndSwitch
WEnd

Cheers

Link to comment
Share on other sites

Do you by any chance have the Pic control state set to disabled?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

OHHHH... Forgot to mention that the picture is on a tab / TabItem and on top of another picture. When I put a picture off of the tab / tabitem, it works, when it is on the tabitem, it doesnt.

EDIT:

@Bert: Yes, but it's messy and long, and uses an .ini and a lot of pics, don't want to release it right now.

Edited by Kickassjoe

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

OHHHH... Forgot to mention that the picture is on a tab / TabItem and on top of another picture. When I put a picture off of the tab / tabitem, it works, when it is on the tabitem, it doesnt.

EDIT:

@Bert: Yes, but it's messy and long, and uses an .ini and a lot of pics, don't want to release it right now.

Create something that repoduces your enviroment... :)
Link to comment
Share on other sites

It was the picture below the picture causing the problem, as seen here.

$Gui = GUICreate(":-)", 120, 58)
$Pic1 = GUICtrlCreatePic(@WindowsDir & "\Blue Lace 16.bmp", 5, 5, 70, 70)
$Context0 = GUICtrlCreateContextMenu($Pic1)
$Context1 = GUICtrlCreateMenuitem("Exit", $Context0)

$Pic2 = GUICtrlCreatePic(@WindowsDir & "\Greenstone.bmp", 20, 20, 40, 40)

$Context0 = GUICtrlCreateContextMenu($Pic2)
$Context1 = GUICtrlCreateMenuitem("doesnt show up", $Context0)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
        Case $Context1
            Exit
    EndSwitch
WEnd

Edit: and no, I don't want to get rid of the bottom pic to solve that, if possible

Edited by Kickassjoe

What goes around comes around... Payback's a bitch.

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