Modify

Opened 16 years ago

Closed 15 years ago

#628 closed Bug (Fixed)

GUICtrlRead($id, 1) on control context menu returns -1 unless main window has menu

Reported by: Rob Saunders <rob@…> Owned by: Jpm
Milestone: 3.2.13.10 Component: AutoIt
Version: 3.2.13.9 Severity: None
Keywords: context menu Cc:

Description

Sorry for the long summary, but I couldn't think of a better way to sum up. Anyway, it appears that context menu items for controls will only return -1 with GUICtrlRead($ID, 1) unless a menu of some sort has already been added to the main window. I did a search and it looks like it may be related to bug #399, but it is different enough I thought it deserved it's own ticket.

Test(1) ; Bugged example
Test(2) ; Workaround example 1
Test(3) ; Workaround example 2

Func Test($test)
	$gui = GUICreate(@AutoItVersion, 200, 200)

	If $test = 2 Then
		GUICtrlCreateContextMenu() ; Create empty ContextMenu for the window
	ElseIf $test = 3 Then
		GUICtrlCreateMenu('File') ; Create empty 'File' menu for the window
	EndIf

	GUICtrlCreateLabel('Test ' & $test, 10, 10, 100, 20)
	$bt = GUICtrlCreateButton('Right click me', 10, 50, 100, 30)
	$cm = GUICtrlCreateContextMenu($bt)
	$mi = GUICtrlCreateMenuItem('Click me', $cm)
	
	GUICtrlCreateLabel('GUICtrlRead($mi, 1) = ' & GUICtrlRead($mi, 1), 10, 100, 180, 20)
	
	GUISetState()

	While 1
		$gm = GUIGetMsg()
		Switch $gm
			Case -3 ; $GUI_EVENT_CLOSE
				ExitLoop
			Case $mi
				MsgBox(0, 'Test', 'GUICtrlRead($mi, 1) = ' & GUICtrlRead($mi, 1))
				ExitLoop
		EndSwitch
	WEnd
EndFunc

Attachments (0)

Change History (2)

comment:1 Changed 15 years ago by Jpm

  • Summary changed from GUIRead($id, 1) on control context menu returns -1 unless main window has menu to GUICtrlRead($id, 1) on control context menu returns -1 unless main window has menu

comment:2 Changed 15 years ago by Jpm

  • Milestone set to 3.2.13.10
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in version: 3.2.13.10

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.