Checkbox menu items in wxPython - python-2.7

I Have a subclass of wx.Frame in which I have constructed a fully functioning editor with a menu and multiline text input. I next need to create a checkbox menu item inside a menu created with this code:
self.menuBar = wx.MenuBar()
self.menuBar.Append(self.viewMenu, "&View")
self.SetMenuBar(self.menuBar)
Using this code:
self.HideToolbarMenuItem = self.viewMenu.Append(wx.ID_ANY, "Hide Toolbar", self.HideToolbarHelp, kind=wx.ITEM_CHECK)
How do I add event handling to it or get it's value (True or False)? I am not interested yet in how to hide the toolbar.
EDIT: The menu does show the checkbox, and it can be selected

Use self.HideToolbarMenuItem.IsChecked() and a normal event handler. Example:
def OnBoxChecked(self, event):
if self.HideToolbarMenuItem.IsChecked():
self.statusbar.SetStatusText('Checked')
else:
self.statusbar.SetStatusText('Not Checked')

Related

How to set modal dialog title dynamically in oracle apex 18

I want to set modal dialog title dynamically based on an interactive element.
ex) In page 50, I've made an Interactive Grid and set the link on "Title" column, when user click on title column, a modal dialog appears.
I want to set the title of that modal dialog to title column's content.
But modal dialog's title doesn't change dynamically.
In this case, how can I apply the titles dynamically?
I've seen many solution related to this question, but I can't solve my problem.
Let's say, your model page number is 51. Here are step by step approach [TESTED] to dynamically change title of model page:
Create a hidden item in your model page, let's say the hidden item name is P51_Title.
In Interactive report -> title column link -> click on link builder box -> set values -> add Hidden item as P51_TITLE under Name and value as '#Title#' Column (#ColumnName#).
In model page 51 static region header (title property), add hidden item value as &P51_TITLE. (dot is mandatory to add at last. This is substitution string with & and dot(.) before and after of item name respectively)
save both the pages and run. when you will click on title column link, the link will be redirecting to the model page and title data will be passed through URL to hidden item in the session, so model page header will automatically change based on title data from report.
I made such dialogcreate js function.
It moves popup page Title to modal dialog title.
So, dynamic calculated title &P51_TITLE. would be applied automatically.
$(document).on("dialogcreate", ".ui-dialog--apex", function(e) {
var lDialog = $(this);
lDialog.find('iframe').on('load',function () {
lDialog.children(".ui-dialog-content")
.dialog("option", "title", $(this.contentDocument).find('title').html());
});
});
I am very disappointed that something like this (or any other solution) do not work in apex modal pages by default!

Setting session variable on click

I've got a popup message with a close button at the top. If the user clicks the close button, they should never see the message again while on the site. If they don't click the close button, they will see it on the top of each page on the site.
When the user clicks the close button, I want to set request.session['promo'] to 0. On subsequent page loads on the site, if request.session['promo'] == 0, I will not show the popup message.
What is the best way of setting a session variable on click in django?
Thanks for the direction!
In HTML OnClick of button just call a function in views.py
Ex:
IN HTML :<Button onclick={% your_fucntion %}></button>
IN VIEWS.PY :
def your_fucntion(request):
request.session['promo'] == 'your_variable'
for getting variable :
promo = request.session['promo']

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

show textbox on radiobutton click django

I have two radio buttons and on the selection of one radio button i want to show the textbox. if the user selects the radio button with the value of "other" then display the textbox, if its anything else dont display the textbox.
apply_type= (
('Online',_('Online')),
('Others',_('Others')),
)
how_to_apply = models.CharField(verbose_name=_('How to Apply'),max_length=255,null=True, choices=apply_type,default='Online')
How can this be done in django?
One way is to just use javascript client-side to show an input when a certain radio button is checked.
If you want to do it in django, you could use a form wizard and have the selections that are made on the first form affect the rest of the forms that are displayed.

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