comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Context Menu ib widget_tree
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Context Menu ib widget_tree [message #94900 is a reply to message #94852] Wed, 29 November 2017 02:20 Go to previous message
klet Jegou is currently offline  klet Jegou
Messages: 1
Registered: November 2017
Junior Member
Hi,

Maybe have you find the answer to your question since, but if not, this is a way to do what you want.

I have found the explanation to do it on this two pages in Harris documentation:

http://www.harrisgeospatial.com/docs/Creating_Menus.html
https://www.harrisgeospatial.com/docs/widget_tree.html

You have also access to several examples in examples/doc/widgets subdirectory.

;-------------------------------------------------;

; Manage context_menu event
pro context_event_Handler, event
WIDGET_CONTROL, event.ID, get_value=value
case value of
'button1': BEGIN
print,'button1'
END

'button2': BEGIN
print,'button2'
END
endcase
end

; Manage classical event from the widget
pro test_treecontext_event, event

; Test for context menu events
IF (TAG_NAMES(event, /STRUCTURE_NAME) EQ 'WIDGET_CONTEXT') $
THEN BEGIN
; Obtain the widget ID of the context menu base.
contextBase = WIDGET_INFO(event.ID, $
FIND_BY_UNAME = 'contextMenu')
; Display the context menu and send its events to the
; other event handler routines.
WIDGET_DISPLAYCONTEXTMENU, event.ID, event.X, $
event.Y, contextBase
ENDIF

end


pro test_treecontext

tlb= widget_base(/column)
tre_bs= widget_tree(tlb, /no_bitmaps, /expanded, /CONTEXT_EVENTS)

tre_fo= widget_tree(tre_bs, /folder)
tre_s1= widget_tree(tre_fo, value='Size 1') ;need context Menu
tre_s2= widget_tree(tre_fo, value='Size 2') ;need context Menu
tre_s3= widget_tree(tre_fo, value='Size 3') ;need context Menu

contextMenuB = WIDGET_BASE(tre_bs, /CONTEXT_MENU, $
UNAME="contextMenu")
button1 = WIDGET_BUTTON(contextMenuB, value='button1', $
event_pro='context_event_Handler')
button2 = WIDGET_BUTTON(contextMenuB, value='button2', $
event_pro='context_event_Handler')


widget_control, tlb, /realize

; Handle the events from the GUI.
XMANAGER, 'test_treecontext', tlb, /NO_BLOCK
End

;-------------------------------------------------;

Klet
[Message index]
 
Read Message
Read Message
Previous Topic: finding star-like objects in images
Next Topic: How to set environment variables in IDLDE

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:14:37 PDT 2025

Total time taken to generate the page: 0.00377 seconds