Refreshing R Shiny Result Panel without closing app - r

I am updating one of my Shiny apps and have implemented a "Refresh" button that is supposed to remove output from the Result Panel (i.e., where plots/tables are printed to) in Shiny:
actionBttn(inputId = "refresh",
label = "Refresh",
color = "success",
style = "jelly",
size ="sm",
block = FALSE
)
I have seen this previous SO Post: refresh the main panel screen in shiny using the action button, which is not exactly what I'm after, since running it simply closes the app itself (which can be accomplished directly in RStudio anyway). I swapped an observe() for an observeEvent(). Trying it both ways gave the same behaviour.
In my case, the app window should remain open, but upon pressing the "Refresh" button, should result in a blank Result Panel.

Related

QComboBox Does Not Display Current Text in UI When a Non-Default Value is Selected

I am developing a UWP application for Windows 10 using Qt for UWP.
One of the UI elements in my application is a QComboBox. The application's logic and the corresponding UI works as expected when the default value (text) is not changed.
However, when I select a different value from the drop-down list, the selected value is not displayed once the drop-down list closes. The box still shows the default value (text). But when I observe the value received by currentIndex, it corresponds to the selected value. Whenever I select a non-default value, the UI seems to be blocked. I cannot interact with any other UI elements except the QComboBox element.
Has anyone faced this problem before? How do I ensure that the current selected values is displayed in the QComboBox?
UPDATE:
I built a demo application to check the QComboBox functionality on its own and I see the same behavior. I just added a few items to the QComboBox widget and built the application with both msvc2017_64 and winrt_x64_msvc2017 of Qt 5.14.1.
When I launch the app that was build using msvc2017_64, I get a window with the QComboBox widget. When I select a value, that value is displayed when the drop-down menu closes.
However, when this is not the case with the UWP application that I build with winrt_x64_msvc2017. It does not show me the updated value. It stays stuck at the default value.
Another problem that I observed in my original UWP app was that whenever I click on the QComboBox and select a value, I do not get control of the UI back. Everything in the UI is stuck but whichever button I click is emitting the signal in the background. The UI does not respond at all.
UPDATE 2
I was tinkering around trying to understand what was causing this behavior. During this process, I stumbled upon a workaround to get the UI to respond again. If I launch a QMessageBox within the QComboBox's currentTextChanged signal, I get the UI control back (the currentText changes to the value that I previously selected) when I press OK on the QMessageBox pop-up.
I do not understand why this workaround gives me back control of the UI and gets things working. Please help me understand this.

How to get submitButton to not take effect until after the initial loading of the R Shiny App?

I have a Shiny app that has widgets which control the out of a map.
There are several inputs.
I don't want the map to reload until the user has edited all of the inputs they want to edit.
Hence I have this line of code:
submitButton("Update Map", icon("refresh"))
in my UI, which only reloads the map if the user press on the button.
But now it won't load the initial map upon the launching of the app.
I want that behavior.
What do I need to change?

R: Hover Event in Shiny App

I have a datatable within a Shiny app containing thousands of records and 10 fields. One of the fields, 'Notes', contains the body of a unique email sent to each record. Due to the size of some of the emails, it takes up a lot of room in the datatable. I would like to create an info icon for each row that when hovered over will display the email associated with that row in a popup window which will subsequently go away after moving the mouse off of the icon. Is this possible in Shiny?
Yes. First, you'll need to process that email text as HTML and add the following tags:
<i class='fa fa-info-circle' data-toggle='tooltip' data-placement='right' title='YOUR EMAIL TEXT'></i>
Depending on the size of your email, that tooltip might become a bit heavy, but this does what you want it to do.
Note that this is assuming you're running shinyDashboard (although I think any of the options - fluidPage, navbarPage etc - will work).
You also need to set escape = FALSE in datatable(x, escape = FALSE)
You can have a look at this implementation. For a table demo, click on GO, then click on the 'Health Behaviors' tab.
http://healthpolicy.ucla.edu/health-profiles/adults/Pages/dashboard.aspx

wxPython issue in changing button text

I am working on a wxPython app where I have a button with label text 'Allocate'. Additionally I also have 2 radio options on my app namely 'UnAllocated' and 'Allocated'. When the app launches by default the radio option 'UnAllocated' is selected and the button has label text as 'Allocate'. I have made event driven code to change the label text of the button from 'Allocate' to 'Re-Allocate' upon selecting the radio option 'Allocated'. Uptill now everything is fine and code works as intended.
Now the problem is in the event of radio option 'Allocated' the button label does gets a new label text as 'Re-Allocate' however it is overwriting the previous label text instead of changing. Then as soon as I bring my mouse cursor on the button the text gets refreshed and appears clean and clear. Below is my Code
def rdoAllocated_Click(self, event):
self.btn_Allocate.SetLabelText('Re-Allocate')
def rdoUnAllocated_Click(self, event):
self.btn_Allocate.SetLabelText('Allocate')
is there a way of refreshing the button label text automatically after the change to display clearly the new text instead of unreadable overwritten text.
Here is the image how it looks when getting updated
Try calling self.btn_Allocate.Refresh() This can happen sometimes, depending on platform and widget types. The Refresh simply tells the system to send a paint event in the near future, and will most-likely take care of the problem for you. If not then you may need to call the parent window's Refresh instead.

Send selectInput value when input changed (without needing submit button) Shiny R

I am trying to make it so that when I change my selectInput value it reactive value is passed automatically without needing to press a submit button. Is this possible?
selectInput("variable1", "Choose ID:", vec)
The above requires a submit button to be clicked before the value is passed.

Resources