I'm writing an application using GTK3 and gtkmm. I'm adding a menu button to the header bar. So far, I got items to show up, but I can't add a separator.
Here's where I create the menu:
auto main_menu = Gio::Menu::create();
...and add some items:
main_menu->append("Export to WAV", "app.exportToWav");
main_menu->append("About", "app.about");
And here's what I get:
But I want to add a horizontal line between the two items. There seems to be no obvious way to do this with Gio::Menu, and I want that popover. I tried adding an item with "-" as its content, but that did nothing. Gtk::SeparatorMenuItem exists, but it doesn't seem to be compatible. Is this even doable with this kind of menu?
I've figured it out. Turns out, with Gio::Menu, you don't specify "separators," per se. Instead, you specify sections.
Essentially, what this means is creating multiple menus, and then grouping them all together in a single menu using the append_section(Gio::MenuModel) function.
Here's what I ended up doing:
// Create master menu
auto main_menu = Gio::Menu::create();
// Create menu sections
auto main_menu_section1 = Gio::Menu::create();
auto main_menu_section2 = Gio::Menu::create();
// Add item(s) to first section
main_menu_section1->append("Export to WAV", "app.exportToWav");
// Add item(s) to second section
main_menu_section2->append("About", "app.about");
// Append the new sections to the master menu
main_menu->append_section(main_menu_section1);
main_menu->append_section(main_menu_section2);
Then, each section is separated by a horizontal line:
It's faint, but it's there
Related
I'm using Acumatica customization Acumatica-LotSerialNbrAttribute
This customization adds a new screen for look for InventoryID and LotSerialNbr and visualize its attributes.
I'm trying to add this window to the acumatica mobile app.
Here my code:
add screen IN202501 {
add container "InventoryLotSerialContainers" {
add field "InventoryID"
add field "LotSerialNbr"
add group "Attributes" {
displayName = "Attributes"
collapsable = True
add attributes "AttributesAttributes"
}
add recordAction "Save" {
behavior = Save
}
add recordAction "Cancel" {
behavior = Cancel
}
attachments {
}
}
}
And the screen is visible on the mobile app with the 2 selectors
Then I select Inventory and when I select Lot Serial Nbr, the first selector is in blank, causing that I can't review the attributtes neither save the information.
Here the InventoryID selector in blank.
Hope you can help me to successfully publish this screen on acumatica mobile app.
Thanks.
Attributes are a grid style representation in Acumatica. That means you need a container that will show multiple records. I'm getting rusty on mobile pretty quickly, but I believe your definition is set to display a single value value only.
Try adding a separate container for attributes:
add container "AttributesAttributes" {
add field "Attribute"
add field "Value"
}
This should open into a view of multiple records, showing all of your attributes. By specifying the Attribute and Value fields, you should see both data elements in the container.
I'm trying to customize a page so that the edit button (the pencil icon one) directs the user to a specific page. In my case, the edit button is linked to a BAccountID field :
By default, it opens the Business Account's page (page CR303000):
I would like it to open a different page that I created that has a similar BAccount view (page AR303001) :
Can this be done ? And how ? I can't seem to find the code behind this logic.
The target graph is declared in the PXPrimaryGraph attribute decorating the DAC.
BAccount DAC is a special case that uses a more complex attribute (CRCacheIndependentPrimaryGraphList) that inherits from PXPrimaryGraph.
[CRCacheIndependentPrimaryGraphList(new Type[]{
typeof(CR.BusinessAccountMaint),
typeof(EP.EmployeeMaint),
typeof(AP.VendorMaint),
typeof(AP.VendorMaint),
typeof(AR.CustomerMaint),
typeof(AR.CustomerMaint),
typeof(AP.VendorMaint),
typeof(AR.CustomerMaint),
typeof(CR.BusinessAccountMaint)},
new Type[]{
typeof(Select<CR.BAccount, Where<CR.BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>,
And<Current<BAccount.viewInCrm>, Equal<True>>>>),
typeof(Select<EP.EPEmployee, Where<EP.EPEmployee.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AP.VendorR, Where<AP.VendorR.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AP.Vendor, Where<AP.Vendor.bAccountID, Equal<Current<BAccountR.bAccountID>>>>),
typeof(Select<AR.Customer, Where<AR.Customer.bAccountID, Equal<Current<BAccount.bAccountID>>>>),
typeof(Select<AR.Customer, Where<AR.Customer.bAccountID, Equal<Current<BAccountR.bAccountID>>>>),
typeof(Where<CR.BAccountR.bAccountID, Less<Zero>,
And<BAccountR.type, Equal<BAccountType.vendorType>>>),
typeof(Where<CR.BAccountR.bAccountID, Less<Zero>,
And<BAccountR.type, Equal<BAccountType.customerType>>>),
typeof(Select<CR.BAccount,
Where2<Where<
CR.BAccount.type, Equal<BAccountType.prospectType>,
Or<CR.BAccount.type, Equal<BAccountType.customerType>,
Or<CR.BAccount.type, Equal<BAccountType.vendorType>,
Or<CR.BAccount.type, Equal<BAccountType.combinedType>>>>>,
And<Where<CR.BAccount.bAccountID, Equal<Current<BAccount.bAccountID>>,
Or<Current<BAccount.bAccountID>, Less<Zero>>>>>>)
},
VerifyRightsBy = new [] { typeof(CR.BusinessAccountMaint) })]
There is no way to easily customize this attribute. To change it would you need to replace the BAccount DAC with another one. The preferred method for your use case is to avoid usage PXPrimaryGraph attribute by using a regular action button.
The action button can be configured to show the pencil icon:
Make PXButton appear as pencil icon
And it can be displayed beside the field using PXLayout Merge property or you can use LinkCommand to redirect:
https://stackoverflow.com/a/60446714/7376238
I'd like to append a new menu entry right below "Enter Full Screen", but I am failing to find the right CommandGroupPlacement property.
CommandGroup(after: .<what needs to be put here??>) {
//my buttons here
}
Attempting to override "View" results in just another group with the same name (see image).
CommandMenu("View") {
//add button here
}
Shoutout to Majid Jabrayilov for his blogpost on this: https://swiftwithmajid.com/2020/11/24/commands-in-swiftui/
To find a solution to my above issue though I still had to think a bit around the corner–what does work is this:
CommandGroup(before: .toolbar) {
Button("Foo") {
}
}
This works, because the toolbar menu entry is located within "View" (even thought I don't have a toolbar in my app, the placement still works nonetheless...)
You said you were looking for the proper CommandGroupPlacement so for your case (relative to full screen mode), you would technically want CommandGroupPlacement.sidebar. CommandGroupPlacement.toolbar works because toolbar options live in the View menu, though you have none set.
/// Example in a CommandsBuilder
CommandGroup(after: CommandGroupPlacement.sidebar) {
Button("New View Action", action: { print("After sidebar menu options") }).keyboardShortcut("s", modifiers: [.command, .option, .control, .function]
}
This should also come in handy for others. The Apple documentation that corresponds to this: CommandGroupPlacement
I'm creating a menu in gaffer that populate automatically from a string list called "shotlist"
the idea is to have a custom menu for each entry of the list and have an action relative to each entry too, like :
click on sh001 = sh001
click on sh002 = sh002
click on sh003 = sh003
my problem is that my code return :
click on sh001 = sh003
click on sh002 = sh003
click on sh003 = sh003
I understand that when I click on a button, it always return the 3rd value of "shotlist", as it's the last one than the loop worked on, but I dont understand how to set the loop differently to have the right result
actually my code is :
def shotSelection( menu ):
shotVar=str(shotName)
print shotName
scriptWindow = menu.ancestor( GafferUI.ScriptWindow )
root = scriptWindow.scriptNode()
root["variables"]["projectshot"]["value"].setValue( shotVar )
root=application.root()
shotlist=["sh001","sh002","sh003"]
for shotName in shotlist:
GafferUI.ScriptWindow.menuDefinition(application).append("/Pipeline/ShotSwitcher/{0}".format(shotName), { "command" : shotSelection } )
I have also tried with the method described here but i dont understand well enough how it's work to apply it to my script.
the menu creation part from gaffer works well. but I dont found a way to set up my menu from the list and have the right action on it at the same time
thank you
EDIT:
actually I found the problem but not sure how to fix it
GafferUI.ScriptWindow.menuDefinition(application).append("/Pipeline/ShotSwitcher/{0}".format(shotName), { "command" : shotSelection }
shotSelection does not transmit any info of the shot clicked on
i fixed my issue with functools(), allowing to transmit the value in each loop
I have a list control (CListCtrl) with two columns (Name, Value). I add entries dynamically from a xml file. Now i want to make the Value-Column editable and subscribe the Edit-Event to write the changes to the xml. How i do this?
My Code now:
LVITEM item_value;
item_value.iItem = row;
item_value.iSubItem = 1;
item_value.mask = LVIF_TEXT;
item_value.pszText = value;
ctrl->SetItem(&item_value);
Placing an edit control in CListCtrl is easier by setting the LVS_EDITLABELS style. Use EditLabel() function to place an edit control for a specific item, and retrieve the new text from edit control using GetEditControl() function by listening to the notification LVN_ENDLABELEDIT.