VSTO 4/XML: how to make certain controls optionally visible - visual-studio-2017

I've a XML Ribbon made by VSTO-4 and VS2017 functioning in Outlook-2016. I'm not using the Designer provided by Visual Studio, but the entire "Fluent" mode (XML).
This Ribbon if fulfilled with buttons and my clients are "a little bit" lost with so many buttons/options in the same ribbon... and most of them are really just "options" of my program.
I would like to make this Ribbon (named now Ribbon-1) with just 3 buttons, one of them an "OPTIONS" command-button, to call the Ribbon-2, this one filled with all other buttons I have now in Ribbon-1.
Obviously, Ribbon-2 will appear at the same TAB of Ribbon-1 (as least "appearing be in the same TAB") and, once the user set an option, he click on "BACK" button and Ribbon-2 disappear and Ribbon-1 appears again...
We can see this behaviour in some AddIns and I would like to make the same.
Any suggestion?
I appreciate any tip.

Rather than using multiple Ribbons it might make sense to put all the controls in one Ribbon. Use the getVisible attribute to set the visibility of all buttons and groups that should optionally be hidden or visible. Use a toggleButton to show/hide these buttons.
The onAction callback for the toggleButton can set a class-level variable that the getVisible callbacks can check. The procedure then invalidates the Ribbon so that the getVisible callbacks are triggered. These, in turn, check the class-level variable to determine the visibility state of each button.
Note that get callbacks are also executed when the Ribbon loads.
Sample Ribbon XML:
<group id="MyGroup" label="TEST empty" visible="true">
<button id="testButton" label="test empty" visible="true"/>
<toggleButton id="testToggle" label="toggle optional buttons" visible="true" onAction="toggleVisibleControls"/>
<button id="optionalButton" label ="optional" getVisible="isVisible" />
</group>
<group id="Optional" label="Optional group" getVisible="isVisible"></group>
Sample VB.NET code for a VSTO Ribbon XML:
'Generated by VSTO
<Runtime.InteropServices.ComVisible(True)> _
Public Class Ribbon1
Implements Office.IRibbonExtensibility
Private ribbon As Office.IRibbonUI
Private ShowHide As Boolean = False
Public Sub New()
End Sub
Public Function GetCustomUI(ByVal ribbonID As String) As String Implements Office.IRibbonExtensibility.GetCustomUI
Return GetResourceText("VB2010addin_RibbonXML.Ribbon1.xml")
End Function
#Region "Ribbon Callbacks"
'Create callback methods here. For more information about adding callback methods, select the Ribbon XML item in Solution Explorer and then press F1.
Public Sub Ribbon_Load(ByVal ribbonUI As Office.IRibbonUI)
Me.ribbon = ribbonUI
End Sub
Public Function isVisible(ByVal control As Office.IRibbonControl) As Boolean
Return Me.ShowHide
End Function
Public Sub toggleVisibleControls(ByVal control As Office.IRibbonControl, pressed As Boolean)
ShowHide = pressed
ribbon.Invalidate()
End Sub
#End Region

Related

APEX - double click on interactive gird

Below is my interactive grid. It shows data from v$sql_monitor view based on sql_id from list .
What I would like to do is to create double-click dynamic action on a record. This action would open new modal dialog and pass two parameters : 1. sql_id from list above 2.sql_exec_id from clicked record. Would you give me a few hints how to do it ? I guess a piece of Javascript code will be necessary :(
There are multiple options to do this - here is one way, by using javascript custom events. I created a sample with an IG on the EMP/DEPT sample dataset with page 88 as IG and page 90 as modal. The column ENAME is a link to page 90 that sets a column value and a page item in the link.
Page 88 has an IG and 2 page items:
P88_PAGE_ITEM (a value entered on the page like the list in your screenshot)
P88_ENAME (to hold the selected report column value
Page 90 has 2 page items: P90_PAGE_ITEM and P90_REPORT_COLUMN
Create IG on page 90 on table EMP
On column ENAME, add the following under "JavaScript Initialization Code"
function(config) {
config.defaultGridColumnOptions = {
cellTemplate: '<button type="button" class="t-Button t-Button--link my-ename-js" data-ename="&ENAME.">&ENAME.</button>'
};
return config;
}
This is a button of type "display as link", created with the universal theme button builder that has 2 extra attributes: a class my-ename-js and a data attribute "ename" data-ename="&ENAME."
Create a dynamic action to capture the click and set the page item:
Make sure to set the scope to "Dynamic". This is needed because the event listener needs to be added again after a dom change (a search or filter of the IG).
add a true action of type "Set Value" to set the value of P88_ENAME to the value of the selected row
add a second true action to trigger a custom javascript event:
Create a dynamic action of type "Event: Custom" to capture the custom event triggered in the previous DA.
add a true action of type "Submit Page". Note that "Show Processing" needs to be unchecked.
Almost there. One last thing is to create a branch to the modal page:
Create a branch (process point "After Processing") with server-side condition of "Request = Value" with value OPENMODAL and link attributes below:
And this should be the result:
Well, I modified a bit your scenario.
I added new SelectList P88_FILTER
and added dynamic action ON_CHANGE :
with action
I modified source if IG:
These changes allowes me to filter IG . In our case filter returns always only one record like below.
and now my problem begins. In your scenario clicking the link "ename" updates field P88_ENAME and opens modal dialog with proper values. After my modification neither P88_ENAME updates nor modal dialog opens :(

Oracle APEX - How to refresh parent page IG if child modal dialog page opened from custom button

I have an IG on my page with a custom toolbar button that opens a Modal Dialog page. Because of how the modal dialog is opened, ther eisn't a way for me to capture its closure using native Dialog Close.
The javascript I use in my IG to open Modla Dialog is:
apex.server.process(
'GenerateURL',
{x01: l_url},
{success: function (pData) {
console.log(pData);
// Call Modal Dialog Page
apex.navigation.redirect(pData);
},
dataType: "text"
});
The issue is that after the modal dialog is closed I need to refresh my IG. How can I capture modal dialog closure from the parent page?
Modal dialogs should be opened with apex.navigation.dialog. When one calls apex_util.prepare_url for a modal page, it generates the correct JavaScript code that takes into account the settings for the destination page.
There's an option, p_plain_url, that can be used to get just the URL, but don't enable that in GenerateURL as the rest is important. Another parameter, p_triggering_element, allows you to specify the element for a Dynamic Action (that's not an option with apex_page.get_url, which works similarly).
Let's say GenerateURL looked like this (note that I'm passing document as the triggeringElement):
declare
l_url varchar2(512);
begin
l_url := apex_util.prepare_url(
p_url => 'f?p=' || :APP_ID || ':51:' || :APP_SESSION || ':::::P51_ID:' || apex_application.g_x01,
p_triggering_element => 'document'
);
apex_json.open_object();
apex_json.write('url', l_url);
apex_json.close_object();
end;
Then the JavaScript code could be modified to this:
apex.server.process(
'GenerateURL',
{x01: idForURL},
{success: function (pData) {
var funcBody = pData.url.replace(/^"javascript:/, '').replace(/\"$/,'');
new Function(funcBody).call(window);
}
});
Note that the JavaScript is passing an ID to the process that generates the URL, not the whole URL. This makes the use of the process somewhat limited which helps prevent users from abusing it. You could even add a check that verifies the user is able to view the ID value passed in.
With that in place, you can add a Dynamic Action listening for the Dialog Closed event on the document (JavaScript Expression = document). Note that the event will not fire if the dialog is closed via the close or cancel buttons.

Shinyjs: On click option in shiny dashboard

I have a shiny dashboard app with 3 tabs and a notification menu. I am trying to track user activity on the dashboard and wish to log each of their clicks on the dashboard.
The code in server.R for the tabset panel is as below:
output$tabs1=renderUI(
tabsetPanel(type="tab",
tabPanel(id="OverallTab","Overall Activity"),
tabPanel(id="Tab1","Tab 1 details"),
tabPanel(id="Tab2","Tab 2 details"))
Part of my notification code is as below:
output$notiMenu <- renderMenu({
all_nots <- apply(u_notd, 1, function(row) {
notificationItem(text = row[["notification"]], icon("users"))
})
dropdownMenu(type = "notifications", .list = all_nots)
})
I am trying to use shinyjs to write to a dataframe if a user clicks on either of the tabs or notification menu as below:
tab1_clicled=""
tab2_clicked=""
noti_clicked=""
shinyjs::onclick("notiMenu",print("Notification clicked"),noti_clicked="YES")
shinyjs::onclick("Tab1",print("Tab1 clicked"),tab1_clicled="YES")
shinyjs::onclick("Tab2", print("Tab2 clicked"),tab2_clicled="YES")
df=as.data.frame(tab1_clicked,tab2_clicked,noti_clicked)
I face 2 issues here,
1) the on click option doesn't appear to work for the tab panels, using the shinyjs reference(here), I see that there is only a mention of using on click for the tabset panel and not for each tab panel?
2) I'm unable to modify the value of tab1_clicked inside the onclick function. It throws an error saying: Unhandled error in observer: unused argument (tab1_clicled = "YES")
Appreciate any help.
I just quickly skimmed your code and I can see two errors. The first parameter of onclick is the ID of the element. In your case, you want the ID of the actual tab button, but unfortunately the way tabs work in shiny, "Tab1" is actually the ID of the container of the tab panel but it's not the id of the tab button itself. Look at the HTML of a shiny app and you'll see that. Tabs are a bit weird and annoying and it's really difficult to deal with the tab buttons themselves in shiny.
Secondly, The second argument of onclick is the expression, but you're trying to run two expressions print("Tab1 clicked") and tab1_clicled="YES". You need to wrap these in {} so that it's considered one expression, like this:
onclick(id, {print("Tab1 clicked"); tab1_clicled="YES"}
But unfortunately getting the id of the tab button is difficult so I don't think onclick will be useful for that

How to hide the keyboard that pops up in RubyMotion?

How does one hide the virtual keyboard that pops up in a text field?
The button that hides it does not seem to appear and in my case, the next screen that loads (which does not have a text field) will still have the keyboard in the loaded position.
Thanks!
Update:
Using the following allows the keyboard to return:
def textFieldShouldReturn textField
textField.resignFirstResponder
'YES'
end
However, it still remains open upon the next screen.
it should be true instead of 'YES' and don't forget to set the textfield delegate
def textFieldShouldReturn textField
textField.resignFirstResponder
true
end

Oracle APEX: Hide a button with dynamic actions

I'm tying to hide a button when a checkbox is deselected and show the button when selected. But I don't know why isn't it working because I have two date item and they are working fine.
When checkbox not selected
When checkbox selected
http://apex.oracle.com/pls/apex/f?p=17236:555 Workspace:
MACWADU_ORACLE Username: USER Password: 123qweASD
If someone wants to help me, can go to the application page 555 or explain here what I have to do.
Tanks
Your dynamic action tries to hide the button using the DOM Selector "APPLY_CHANGES", but this isn't actually the button's ID (it didn't have an ID at all).
Two changes required (I have made them):
1) Change the Button template to allow button attributes to be added:
<button value="#LABEL#" onclick="#LINK#" class="button-gray" type="button"
#BUTTON_ATTRIBUTES#>
<span>#LABEL#</span>
</button>
2) Change the button itself and set the Button Attributes property to:
id="APPLY_CHANGES"