With a Javascript snippet in Chrome devtools, I can use Shiny.setInputValue('input',0) while my Shiny app is running to reset the value of an actionButton. It works well and I only need that one line.
However, I would like to use it inside my app with shinyjs.
Here is what I have in my .js script (Note that yes, shinyjs is properly set up and I am using it for many other functions throughout my app).
shinyjs.zeroInput = function(inputID) {
Shiny.setInputValue(inputID, 0);
};
I have button A which once clicked needs to reset button B to zero:
observeEvent(input$mybuttonA, {
shinyjs::js$zeroInput("mybuttonB")
})
This does not work and the chrome Javascript console outputs this when button A is clicked:
Note that using Shiny.setInputValue("mybuttonB",0) in the Chrome Javascript console works like a charm. What is going on?
I figured out what was wrong.
All I needed to do was convert the javascript function argument into a string:
shinyjs.zeroInput = function(inputID) {
Shiny.setInputValue(String(inputID), 0);
};
Related
In the Button component we have CustomEventData. In my understanding the purpose it to send extra parameter when user tap the button.
I have tried to use it like this:
use_powerUp(par: string){
console.log("MapScreenManager::use_powerUp() = ", par);
}
The Button will call the function and I thought the CustomEventData will be automatically become 1 parameter that will fill the par parameter. But turns out it didn’t.
Can anyone guide me how to properly use the CustomEventData?
I am using Cocos Creator 3.5.0 with Typescript.
I just found the solution, it's very simple
use_powerUp(event: Event, CustomEventData)
{
}
I'm having trouble making a simple message dialog in C++/WinRT. Something as simple as "You clicked this: press ok to continue" nothing fancy. In the standard Windows API you can simply write MessageBox() and new popup will show up where you can click ok, and you can do somthing similiar in C++/CX with
auto messageDialog = ref new Windows::UI::Popups::MessageDialog("You clicked on the button!"); messageDialog->ShowAsync();
I've tried using IMessageDialog and ContentDialog classes with no success and can't seem to find a single example out there on how to do it without getting into writing Xaml code which for my perticular project seems unnecisary for something as simple as a message box. Maybe I'm just not setting them up right? But then again there are no examples on how to set it up in the first place (in C++). What am I missing?
Thanks!
I was able to form a simple message dialog using this:
winrt::hstring Title = L"Hello";
winrt::hstring Content = L"Some cool content!";
winrt::Windows::UI::Popups::MessageDialog dialog(Content, Title);
dialog.ShowAsync();
Make sure to also include <winrt/Windows.UI.Core.h> so you can get access to the UI library.
And here is the result:
I have to disable standard next button, on my custom page via installscript.qs file.
I can disable my own button (that I created in .ui file) via .qs script like this: widget.myButton.setEnabled(false);
This man shows that native buttons represented as enumeration and I cannot disable them same way.
Controller Scripting manual page shows some interactions with native buttons. Like gui.clickButton(buttons.NextButton). I go through whole gui object man and don't found anything useful.
Qt installer framework has a native license check page with Next button logic that I need, but I have not found any samples that do it manually. (license page work because its default license page and it's logic inside framework as I understand).
Finally I found isComplete() method that can be useful for me, but it is for C++ API not for qs.
So how to disable native button via installscript.qs file?
In case someone else end ups here, I finally found a cleaner solution: a dynamic widget has a property complete that can be changed to enable and disable the "Next" button. Set it to false to disable the button.
Controller.prototype.DynamicMyWidgetCallback = function()
{
var currentWidget = gui.currentPageWidget();
if (currentWidget != null)
{
currentWidget.complete = false
}
}
The only solution i had found is call installer.setValue("canContinue" "false");
Then connect page entered event using gui.pageById(QInstaller.TargetDirectory).entered.
connect(Component.prototype.targetPageEntered);
In targetPageEntered check our value:
Component.prototype.targetPageEntered = function () {
if (installer.value("canContinue") != "true") {
gui.clickButton(buttons.BackButton);
QMessageBox.information("someid", "Installer",
"You must do smth to continue", QMessageBox.Ok);
}
}
Of course you need to change the installer.value when user complete required actions.
I'm having a problem trying to disable Firefox extensions programmatically. Right now, I'm modifying the extension.json file , changing the 2 parameters , active and userDisabled , but without any success. Despite the fact that in the extension menu it appears to be disabled , the icon of extensions still appear in the toolbar and I can see that the extensions still work. Is there a way to make this work using C++ ?
That won't work you have to use AddonManager.jsm to change the property like this:
Cu.import('resource://gre/modules/AddonManager.jsm');
AddonManager.getAddonByID('Profilist#jetpack', function(addon) { //id of the addon
console.info('addon:', addon);
addon.userDisabled = false; //set to true to enable it
});
Want to trigger function on mouse click in browser window via C++ plugin, written with FireBreath.
But with code below nothing happends on click.
Got the following code in TestPluginAPI.h:
BEGIN_PLUGIN_EVENT_MAP()
EVENTTYPE_CASE(FB::MouseDownEvent, onMouseDown, FB::PluginWindow)
END_PLUGIN_EVENT_MAP()
virtual bool onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *);
And this code in testPluginAPI.cpp:
bool TestPluginAPI::onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *)
{
if(evt->m_Btn == FB::MouseButtonEvent::MouseButton_Left)
{
fire_showcrd(FB::variant_list_of(evt->m_x)(evt->m_y));
}
return 0;
}
Fire_showcrd(...) was tested separately and it's working. It seems that something wrong with click detecter part, but what?
The PluginWindow events in FireBreath only apply to the region where the plugin lives, not elsewhere on the webpage. You'll only get events when the plugin itself is clicked on using this method, and if any DOM elements are hovering over your plugin (even if your plugin draws in front because it's windowed) you may end up losing the events to that element.
You can get click events for the whole page by using javascript.