if test:
ConfirmDialog dialog = new ConfirmDialog();
dialog.setCloseOnEsc(false);
dialog.setHeader("ok");
dialog.setConfirmText("ok");
dialog.setText(("ok"));
dialog.open();
ConfirmDialog dialog1 = new ConfirmDialog();
dialog1.setCloseOnEsc(false);
dialog1.setHeader("ok1");
dialog1.setConfirmText("ok1");
dialog1.setText(("ok1"));
dialog1.open();
No open 2 dialogs, but freeze application:
It should open two dialogs, in a hierarchical way.
Related
Using Vaadin Flow Java API I would like to emulate a Vaadin 8 Window feature: particularly I need to emulate Caption behaviour.
I mean a fixed top "Title" not scrollable as the real content of the Dialog. Anyone can tell me some Example I could learn from ?
Thanks in advance
This is the workaround I found.
public MainView() {
Button button = new Button("Click me",
event -> {
Dialog dialog = new Dialog();
HorizontalLayout horizontalLayout = new HorizontalLayout();
VerticalLayout verticalLayout = new VerticalLayout();
Div headerDiv = new Div();
Div bodyDiv = new Div();
bodyDiv.getElement().getStyle().set("overflow", "auto");
bodyDiv.getElement().getStyle().set("max-height", "420px"); // !!!
dialog.add(headerDiv, bodyDiv);
headerDiv.add(horizontalLayout);
bodyDiv.add(verticalLayout);
horizontalLayout.add(new Label("Hi there !"));
for (int i = 1; i <= 20; i++) {
verticalLayout.add(new TextField("TextField_" + i));
}
dialog.open();
});
add(button);
}
The trouble is that I have to fix max-height size to avoid scrolling of all the contained components. So I cannot take advantage from the auto-size behaviour of the Dialog Container. Also tried using setFlexGrow, but I did not reach the solution.
Any Hint ?
In Vaadin 10+ there is no component called Window, but there is component called Dialog. It does not have Title like Window, but otherwise it has similar baseline. I.e. it is popup. Based on your question you have found already that.
Dialog itself is component container, which means you can add components there. I would just create e.g two Divs (the simplest of the layout components in Vaadin 10). I would style the first one to have fixed height and place the Title there. And then I would apply component.getElement().getStyle().set("overflow", "auto") to the other one, which is the actual content body. The mentioned style will enable the scrollable feature. You could potentially use VerticalLayout / HorizontalLayout instead of Div as well depending what you need.
See also: https://vaadin.com/docs/v10/flow/migration/5-components.html
I am using codename one to create an application, and i am in front of a situation that is making me use the "tree component" in the pop-up of the OverFlowMenu
how can i do that?
That won't work. The overflow menu uses a renderer approach and isn't very customizable.
Instead add a command to the right side of the toolbar and show a popup dialog pointing at that button e.g.:
popupCommand = toolbar.addMaterialCommandToRightBar("", FontImage.MATERIAL_MORE_VERT, e -> showPopup());
private void showPopup() {
Button b = toolbar.findCommandComponent(popupCommand);
Dialog popup = new Dialog(new BorderLayout());
popup.add(BorderLayout.CENTER, new Tree());
popup.showPopup(b);
}
This is related to my question posted here:
How to make dialog elments collapsible?
Another developer has added two groups to the dialog that is displayed when creating a payment proposal (CustVendPaymJournal_Vend Class) and the "Ok" and "Cancel" buttons are no longer displayed on smaller resolutions (1024x768).
To overcome this I am trying to group some dialog elements in DialogTabPage tabs. However I haven't had any success in my attempts.
This is what I have in the first couple lines of code in the dialog() method for CustVendCreatePaymJournal_Vend
public Object dialog()
{
LedgerJournalType ledgerJournalType;
DialogTabPage tab;
super();
tab = dialog.addTabPage("First tab");
}
I keep on receiving this error anywhere I try to add a tab in the dialog. I have tried to put it on CustVendPaymJournal (from which CustVendPaymJournal_Vend is inherited) also, but to no avail.
DialogTabPage object does not have method 'frameType'.
Try:
dialog = super();
tab = dialog.addTabPage("First tab");
I have list items on form, I have to display that form on tabs, when the user clicked on a tab.
How to add that form to tab, after form.show() or before?
I need to display first tab as default with Form Screen?
You can display form in Tabs. Form is also a component.
Form frmObj = new Form("Tabs Example");
Form frmOne = new Form("One");
Form frmTwo = new Form("Two");
Tabs tabObj = new Tabs();
tabObj.addTab("Form One",frmOne);
tabObj.addTab("Form Two",frmTwo );
frmObj.addComponent(tabObj);
frmObj.show();
How can I make the command button in my VC++ 6.0 dialog visible or invisible on load?
From the resource editor once you select the button, you can see its properties in the properties window. Here you can set the visible property to true / false. (assuming this functionality is present in 6.0 - i use 2003 now and cannot remember if this used to be present in 6.0)
Add CButton variable
If you want to dynamically change the buttons visibility during load, add a variable for your button using the MFC class wizard. (you are lucky to have this - this wizard seems to have been removed from Visual Studio .NET)
Override CDialog InitDialog
Next override the initdialog function of your dialog box and then once the base InitDialog function has been successfully called, set the buttons showwindow property to SW_HIDE / before showing the dialog box.
Code
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
if (ConditionShow)
m_MyButton.ShowWindow(SW_SHOW);
else
m_MyButton.ShowWindow(SW_HIDE);
return TRUE;
}
You can also do it without adding a CButton variable - just call
In the OnInitDialog method of the window containing the button/control, put in code:
CWnd *wnd = GetDlgItem (YOUR_RESOURCE_NAME_OF_THE_BUTTON)
wnd->ShowWindow(SW_SHOW) or SW_HIDE
What do you mean by 'commnad button' exactly ?
Anyway, you need to obtain the handle of the button then call ShowWindow function:
BOOL prevState = ShowWindow( itemHandle, SW_HIDE );
Only use
ShowDlgItem(Your_DLG_ITEM_ID,1); // visible = true
ShowDlgItem(Your_DLG_ITEM_ID,0); // visible = false