Scrollbar disappears after form location/size changed - winforms

I have a form where I add controls programmatically, and the controls amount may reach an amount that will exceed the users screen resolution. At form_load I set the property AutoScroll to true and when I load the form, if it exceeds the screen resolution it shows the scroll bar and everything is fine until the user changes the properties of the form.
If the form is resized or moved, the scroll bar disappears.
I've tried using the form LocationChanged event and in the event, set true toAutoScroll but it failed.

Solved it. I've set a size limitation on the form and it's no longer disappearing.

Related

Office UI Fabric Panel scrolling to first input

I have a problem with Office UI Fabric's Panel (well, also Modal). I'm rendering them with multiple input fields to provide data for my app. Due to the number of fields the controls are rendered with a scroll bar. After scrolling down and clicking outside of the input, the focus is being set on the first textfield/dropdown in the container panel what causes the whole thing to be scrolled to the top. Is there a way to prevent setting the focus/scrolling to the first element when clicking outside of the input?
This was indeed a bug and has been resolved already. Tested it in the version 5.56.0.

How to reload focus on form controls (dockPanels)

I have one Form with four dockPanels
dock_1
dock_2
dock_3
dock_4
I want to focus on specific dockPanel by changing theirs 'tabIndex'. For dockPanel which should be focused I set tabIndex on 0, rest of dockPanels' indexes I increase.
I need control it inside method to be able trigger changes when I need it. I can set it inside constructor and during form first initialization focus can be set correct but it's not what I need.
The problem is that I can't force realod focus on form so when I change tabIndexes nothing happened.
Do you know how to trigger:
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.UpdateFocusedControl()
It should reload focus inside the form but I'm not able to trigger it.
I tried solutions similar to: myForm.Select() but without any results.
Thanks
The TabIndex property is not applicable for dock panels.
Use the DockManager.ActivePanel property to get or set the currently active dock panel:
dockManager1.ActivePanel = dockPanel1;
The active dock panel is the one that has focus or contains a control that has focus.
When the active dock panel is changed the DockManager.ActivePanelChanged event is fired.

WPF window and element focus

I've got a WPF form inside a window and a short series of events like this:
1) 1st form has series of selection buttons
2) Clicking a button brings up a progress bar window over the existing window
3) Progress window closes and 1st form switches to a new 2nd form using page navigation
The problem is that the 2nd form (and the entire window) no longer has any focus and what's really killing me is that the window is no longer getting OnKeyDown() calls (it's still the top winow). If I hit the tab key the first menu option is highlighted and the following key stroke will fire a OnKeyDown(). Also, if I alt-tab to another app and then alt-tab back to my window it will begin receiving OnKeyDown() again.
How do I figure out where the focus is after the dialog?
If you are using navigation then the focus will have switched to the Page that you have navigated to, assuming that it is Focusable.
You can check that by setting up a breakpoint in a Focused event handle for the Page.
Alternatively you can use an explicit control.SetFocus() in the page.Navigated handler.

Prevent textbox lost of focus in popup when onmouseover is triggered on another div (extjs)

I don't know if this is a browser general issue or if it is related to my code but here is my issue :
Lets say my page contains a link and a menu. I click the link and a popup opens [it contains a textfield or datefield]. When the popup is loaded, the textfield receives focus and the caret appears in the textfield : I can write. Now If i push my cursor on the side and it hovers on the menu, the focus changes and I can't continue writing in the textfield.
Is there a way to fix that ? I've googled it a bit but to no success.
Since you are using an Ext.Window, the browser doesn't know that things behind the window aren't invalid to hover or otherwise interact with. Indeed, someone actually might want their users to be able to interact with the main page behind the window. However, if you don't want this behavior, and the window is supposed to be the only thing the user interacts with, you are looking for modal: true. This will put a mask over the rest of the page, and no hovers or clicks will be applied to anything on the main page.
Example:
new Ext.Window({
modal: true
width: 400,
height: 600,
layout: 'fit',
items: ...
});
I do face the same issue with the following setup
1. using Ext.widget(widg) to create and open (show) a popup window
2. the widg is defined with modal: true configuration
3. one of widg's items is a form with several fields (fields are dynamically created and each time the form might contain different number of fields)
the issue: when I move the mouse out of the form's area (the mouse even stays inside the popup are), the filed that was on focus looses the focus. Happens 100% of the times.
Thanks, Charlie

Optimal setup for warning user before exiting screen when changes have been made

I have a user control ProfileEditor in a WPF application. It has a number of input controls (TextBoxes, ComboBoxes, Radio Buttons, DatePicker). It will be used to add details for a new profile, or change details for an existing profile.
There is a requirement that if any changes have been made from the initial state (blank for a new profile, prefilled with current data for existing profile), if the user tries to leave the screen, they will first be warned that there are unsaved changes. This control will always be on a Page inside a Frame element, so leaving the screen will be either when navigating to a new Page in the Frame, or exiting the application.
What is the optimal setup for this?
I am thinking that there would be some event that would be attached to all data entry controls on the page (or maybe one event per control type) on the TextChanged or SelectionChanged events that would then set a page-level bool property as to whether or not changes have been made. Is there a way to set these using styles for all types of a control on the page at one time?
And then how would I catch the close screen event? Attach something to the Frame.Navigating event?

Resources