When an owner-drawn menu-item is being drawn is it possible to tell if it's a submenu item contrary to an item you'd find on the menu bar?
The goal being drawing the submenu's menu item's text aligned to the left and the width being a constant size, etc, unlike the menubar's menu item's, Apologies for my lack of knowledge, thanks for any help,
How can I hide the row with project name between main menu and navigation bar? See this.
I'm using Applescript to open an application, said application has a webview. I'm trying to select only the webview. Structure of the application appears below. The "Hello" portion is the webview I want to select. I was trying 'UI element 9' but it appears sometimes the app opens and re-orders the controls. In the below iamge, I want the control whose text is 'Hello', which is a WebView.
I would like in the following script to know how to replace UI element 9 with web view 1 or something similar. I just don't know the way to target the webview element.
set i to scroll area 1 of UI element 9 of splitter group 1 of the front window
Looking for Applescript dictionary, I can't find 'web view', but only following UI elements :
browsers, busy indicators, buttons, checkboxes, color wells, columns, combo boxes, drawers, groups, grow areas, images, incrementors, lists, menus, menu bars, menu bar items, menu buttons, menu items, outlines, pop overs, pop up buttons, progress indicators, radio buttons, radio groups, relevance indicators, rows, scroll areas, scroll bars, sheets, sliders, splitters, splitter groups, static texts, tab groups, tables, text areas, text fields, toolbars, UI elements, value indicators, windows.
You can also call/refer to UI element by its name (if any) like :
click menu "File" of menu bar 1
instead of
click menu 3 of menu bar 1
(third menu is usually File menu, after "Apple" and "application")
However, it could be that your application did not defined a name for the relevant UI Element, then only index can be used !
Wakanda's Menu Bar widget seems to not have a sense of hierarchy; that is, clicking an item will highlight it and will not un-highlight a clicked item of a different menu item group. Example below:
"Home" was clicked, and then the submenu item "View Requests" was clicked. "Home" remains highlighted, but it really should have un-highlighted.
It looks sloppy. Do you have any advice for making it nicer?
event.preventDefault() on the onClick event did not prevent the coloring change for the down state.
Edit: This is all one complex menu bar widget. It has menu bar widgets as submenu items. That's what I mean by a lack of sense of heirarchy. Wakanda fails to see the tree of menu bar widgets as ONE menu bar.
In the properties tab of the Menu Bar widget, change the value of "Show submenus" from 'On Mouse Over' (default) to 'On Mouse Click'.
Regards.
I am making my own NSMenu programmatically and popping it up when a button is pressed.
I create NSMenuItems and add them with the NSMenu method insertItem:atIndex:.
For some reason whatever item is at position zero in the menu does not show up. Is this how the menu is supposed to work?
Yes, this is how the menu is supposed to work, if the NSPopUpButton pullsDown. The first item corresponds to the title of the button; just insert "" or whatever you want. It won't show up.
So you're building your menu in reverse order (by iteratively calling insertItem:anItem atIndex:0)? Why not just build it from the top down and successively call addItem:? I've done this lots and never had issues with items disappearing.