CHtmlView class and focus - c++

I am having Dialog Box Application written in MFC.
Dialog is having 3 child controls on it.
2 Buttons (Button 1 & Button 2) and a HTML Control (Class derived from CHtmlView)
HTML Control has been navigated to a HTML page having 2 checkboxes (Check Box 1 & Check Box 2).
Control Z-Order for focus should be like:
Button 1
Button 2
HTML Control then again Button 1
When focus goes to HTML Control. I want it to set to Check Box 1 & then after pressing tab it will be set to Check Box 2.
But When I press tab while the focus in on Check Box 2, I want it to set to Button 1.
i.e.
I want focus cycle like : Button 1 -> Button 2 -> Check Box 1 in HTML Control -> Check Box 2 in HTML Control -> then again Button 1
Problem:
When the focus is set to HTML Control, it doesn't get set to Check Box 1 and after pressing tab while focus is on Check Box 2 focus doesn't
come back to Button 1.
Let me know if question is not descriptive enough, I will simplify it more.
Appreciate your time.

I can't test it but you may try to add the WS_EX_CONTROLPARENT style to the HTML control.
int OnInitDialog(...)
{
HWND html = GetDlgItem(dialog, ID_HTML);
DWORD ex_style = GetWindowLong(html, GWL_EXSTYLE);
SetWindowLong(html, GWL_EXSTYLE, ex_tyle | WS_EX_CONTROLPARENT);
return 0;
}
I hope it works.

Related

Bootstrap Modal select dropdown expanding outside window

I currently have a select dropdown which is expanding outside the modal window. Is it a better design to increase the window height and keep the dropdown inside it ? ( in which case how to do it ?)
or better keep using this current design ?
in your CoffeeScript you can grab the click event of your dropdown, and reset the height of your modal window:
toggleModalHeight = ->
$('#your_drop_down').on 'click', (event) ->
$('#modal_id').css('height','new height here')
$(document).ready toggleModalHeight
#For avoid Turbolinks issues
$(document).on 'page:load', toggleModalHeight
Within the toggleModalHeight function you can even calculate the new height of your modal and set it properly. Hope have helped you.

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

Checkbox menu items in wxPython

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')

How to toggle visibility action bar tab navigation?

I use Action Bar Sherlock library.
In SherlockFragmentActivity, Make tabs and pager (Swipe + Tab)
actionBar.addTab(actionBar.newTab().setText("tab1").setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("tab2").setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("tab3").setTabListener(this));
When paging. I change tab.
When tab selected, I change page.
(These works fine.)
And make button to toggle visiblity.
actionBar.setNavigationMode(NAVIGATION_MODE_TABS); // this force tab index = 0
//or
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
But Setting navigation mode to NAVIGATION_MODE_TABS,
make tab index = 0 not current tab(pager) index
Try storing current tab index to an integer before you call actionBar.setNavigationMode(NAVIGATION_MODE_TABS);
int index=actionBar.getSelectedNavigationItem();
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
actionBar.setSelectedNavigationItem(index);

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.