Windows Forms Error Provider does not display in custom tab control - tabcontrol

I'm trying to build a Wizard framework in Windows Forms. I've managed to glean a lot of useful tips from this and other sites which have gotten me very close to success. However, I'm having a problem with displaying an ErrorProvider on any tab page other than the first page of the wizard.
My Wizard control is a UserControl. It contains a custom tab control that I've derived from TabControl so that I can hide tabs and ignore attempts to navigate between tabs using keypresses, along with the usual collection of Back/Next/Finish/Cancel buttons at the bottom of the control.
I've used reflection to allow me to raise the validation events on a particular TabPage that belongs to the Wizard Control when I hit the Next button. (I don't want to validate the whole TabControl, only the currently active page.) When I do this, I see in the debugger that my Validating routine for the controls on the current tab page is correctly called and I see that I've called the ErrorProvider that I've attached to the particular control (a TextBox in this case) with a valid error message. I set Cancel to true for the CancelEventArgs in the validating routine and that's picked up by the code that uses the reflection mechanism so that I see that I've failed and don't change tabs. And I set the focus successfully to the control that failed validation.
So all that appears to be working just fine.
Unfortunately, I don't see the ErrorProvider's cheery blinking icon unless I'm on the first tab page. For all of the other tab pages, there's no message visible at all.
I'm baffled. Any thoughts? I can provide code snippets, if helpful.
Thanks!

I assume that in your case the button that moves to the next step of the wizard is placed outside (below) the TabControl
I noticed that the icon is displayed correctly if I pressed the button without releasing the mouse button. It seems that the button outside the container gets focused event though a validation error has occurred (normally you would not be able to leave the active control).
I worked around this issue by registering an event handler for the buttons MouseUp event to "refocus" the TabControl:
private void cmdOK_MouseUp(object sender, MouseEventArgs e)
{
tabControl1.Focus();
}
Note: you also need to set your forms ActiveControl property the one of the controls that failed validation.

Related

Tab Key Stops Moving Between Input Fields

For the time being, this is a Material-UI question.
I have a situation where the tab key ceases to move the text cursor between TextFields. At the moment, I have no idea where in my code this is happening, and I am hoping someone can point me in the right direction so I can start looking.
Here’s the setup:
A mouse click causes a Dialog to be displayed. The Dialog has
several TextFields as well as 2 FlatButtons, “cancel & “submit”
At this state, tabbing between fields works as expected.
If I hit the “cancel” button, an event is fired which updates state (including the display of the Dialog) and the Dialog is closed. I can repeat the process from the top with no issues.
If I hit the “submit” button, an event is fired which does some async stuff (using rxjs epics).
On success, the epic fires an event which updates the state (including the display of the Dialog)
If I now try to repeat the process from the top, the tab key does not respond.
I am in the process of migrating to v1, and checked some of the v0.* components – they have the same problem – I don’t recall that being an issue before… Possible conflict between the two versions of the library?
Figured it out. Yes, there is a conflict between the v0.20 and v1.0 of the Dialog component. At least when you have one opening on top of another. Having changed all Dialogs to v1.0, the problem disappeared.
By the way, its not that the tab key wasn't responding - it was responding in the lower Dialog component and not in the top (latest to be created) one. This problem disappeared once the same version was used for both.

Popup shrinking when selecting any dropdown

I have developed a popup using Oracle ADF and am now facing an issue with this pop-up screen on deployment environment. This popup is created as on click of Sidebar Navigation which calls a bounded task flow which is launched in a popup window.
The pop-up consists of fields both drop-downs and text boxes and is shrinking to a very small size whenever any drop-down is clicked. I have looked up in on the web for this issue but found only one possible solution that "modal" property of af:dialog of af:popup must be true. But this did not resolve my issue as this property was set to true only.
Any pointers in this regard will be highly helpful.
Finally found the issue with the help of my teammate.
We were using Conditional activation of taskflow using an EL expression and which was in requestScope and hence any click on the dropdown was trying to postback to the server and the EL was evaluated every time, but as we had TaskFlowPageDef active property defined with a request scope variable, it was not available for the next request. Hence the taskflow was shrinking.
Changed the scope to viewScope and now its perfectly working fine.
For more details: refer to this blog

Dialog in a Dynamic Content Control

I have a custom control that contains a dynamic content control. The dynamic content displays one of several custom controls. This control is then added to the middle facet (callback1). A Navigator then controls which panel in the dynamic control displays. To this point everything works as it should.
One of the pages that is displayed in the dynamic content has a button that calls a dialog. When the button is clicked it looks like it it is trying to display the dialog but it does not (no errors reported).
If I put the dynamic content control in a simple XPage and load this XPage and have the panel with the control that contains the button to display the dialog open by default it works fine.
So it would appear that the Extension Library Application Layout is blocking the dialog from displaying. I'm at a loss I have the whole application working but not in the ext Library application layout. Wasting an awful lot of time, and not using the ext library app layout is not a good option either.
Found the problem. On the Application Layout custom Control I had some code in the onClientLoad with a try{}catch. If this code failed it 'blocked' the dialog box from displaying properly but the other functions of the window seems to work OK. So I'm not sure what exactly was going wrong in the inner workings of the Application Layout but I moved the code to the BeforePageLoad event and everything now works fine.
This is the code that I moved from onClientLoad to beforePageLoad :
if (!sessionScope.containsKey("ssHelpRepID")){
try{
sessionScope.put("WFSRulesRepID",database.getProfileDocument("frmConfigProfile","").getItemValue("WFSRulesRepID")[0]);
sessionScope.put("WFSRulesRepID_formula",database.getProfileDocument("frmConfigProfile","").getItemValue("WFSRulesRepID_formula")[0]);
sessionScope.put("WFSHelpRepID",database.getProfileDocument("frmConfigProfile","").getItemValue("WFSHelpRepID")[0]);
sessionScope.put("WFSHelpRepID_formula",database.getProfileDocument("frmConfigProfile","").getItemValue("WFSHelpRepID_formula")[0]);
}catch(e){
sessionScope.put("ssError","Error in setting Rep IDs");
}
}
Once I did that the original Application Layout started allowing the dialog to be displayed. Very strange, wish I could bill the time to someone :-)

GWT buttons not responsive after RequestBuilder callback

GWT 2.5.1; using Eclipse 4.2 with GPE;
UI specified with UiBinder
The app puts up a splash screen containing a "Go" button. That button's click handler does various initialization, including hiding itself and showing three other buttons, images, and text; it also initiates a server request (XMLHttpRequest) via a RequestBuilder. The RequestBuilder callback uses the returned server data to draw a bar graph in a canvas element.
After I click the "Go" button the browser window looks as expected with all the visual elements mentioned above. But the three buttons are not responsive to clicks. Not only are their handlers not invoked, they don't show the slight visual indication of activation when the mouse is clicked on them. The browser is not frozen; e.g., if the window is resized the app's resize handler is called.
Based on logging: after the "Go" button handler returns the RequestBuilder callback executes; then "nothing happens" i.e., there are no more log outputs (unless I resize the window).
FWIW this is my first GWT endeavor.
By experiment, I found a partial answer. The three non-responsive buttons are declared in the ui.xml file with {style.hidden} referring to a visibility:hidden attribute in my .css. In the java code I unhide these buttons with:
protected void showElement(Element e) {
e.removeClassName(style.hidden());
}
Evidently starting life as hidden and then shown this way is insufficient to activate the buttons. I am about to go off to research why this is so, but an answer to this "smaller" question is still welcome as long as I've not posted a comment indicating that I am less ignorant.
(too long for a comment)
I have just discovered that the problem relates to the fact that I have buttons in the same position, of which only certain ones are supposed to be visible at a given time. In other words, the user would see at the same position on the page one of:
ButtonA ButtonB ButtonC
or
ButtonD ButtonE ButtonF
or
BigButtonG (as wide either of the preceding groups)
The problem is that regardless of visibility, whichever of the three above displays is declared last has (in effect) a higher z-index and is the only one that will be mouse-responsive. So I am just about to implement a solution of explicitly setting div z-indexes in the code which shows/hides button groups.
Can you set the button's positions in your UiBinder file rather than in your Java code? Place them in a HorizontalPanel and they'll be spaced automatically.
And rather than interacting at the Element level to hide a button, instead call your button instance with setVisible(true); e.g., buttonA.setVisible(true)

GWT - Dialog Box with Places/Activities

I have a header bar at the top of the page which contains buttons and anchors. One of the anchors on the header bar opens a dialog doing the following:
The view calls the activity which does a goTo to a new place, in the start method of the activity which is associated with this place, is a call to instantiate a custom dialog box.
Now there are two problems which are occurring here:
1) Because the place is being navigated to from the header bar, the header bar activity is being shut down by the activity manager so the buttons do not work after clicking the anchor. I do not want the header bar activity to be shut down.
2) Upon clicking this anchor, my main panel in the centre of the screen becomes blank. I have no idea why this is happening but obviously dont want it to.
How to fix these two issues?
I do not want the header bar activity to be shut down.
Have a look at David Chandler's Google I/O 2011 GWT session. It touches on the type of master/details architecture you're describing. I highly recommend it in general and for this question specifically the part following the 18th minute, when David begins a thorough overview of Activities and Places.
Just as suggested in the presentation, you might choose changes to your header bar to happen in reaction to PlaceChangeEvents only, without there being a full-fledged header bar activity.