Aug 20, 2019, 5:15 PM
[CLOSED] Toolbar and events on form fields
Hello support team,
I use the following toolbar configuration based on the scenario suggested in post 284071:
1. Code unchanged - blur event is triggered only after clicking on buttons in the Output group.
2. Comment out
3. Put
I definitely need
But why is it behaves this way and is there any work-around to preserve all the features and still be able to capture blur events on the input fields?
Thank you for your assistance.
Kind regards
Dan
I use the following toolbar configuration based on the scenario suggested in post 284071:
@{
Layout = null;
var X = Html.X();
Toolbar toolbar = new Toolbar()
{
Border = false,
Dock = Dock.Top,
EnableOverflow = true,
OverflowHandler = OverflowHandler.Menu
};
toolbar.Plugins.Add(new BoxReorderer());
toolbar.LayoutConfig.Add(new HBoxLayoutConfig() { Align = HBoxAlign.Stretch });
ButtonGroup grpSave = new ButtonGroup { Title = "Save" };
grpSave.LayoutConfig.Add(new HBoxLayoutConfig() { Align = HBoxAlign.Stretch });
grpSave.Items.Add(new Button { Icon = Icon.Disk, IconAlign = IconAlign.Top, Text = "Save" });
grpSave.Items.Add(new Button { Icon = Icon.DiskEdit, IconAlign = IconAlign.Top, Text = "Save+New" });
grpSave.Items.Add(new Button { Icon = Icon.DiskError, IconAlign = IconAlign.Top, Text = "Save+Close" });
ButtonGroup grpOutput = new ButtonGroup { Title = "Output" };
grpOutput.Items.Add(new Button { Icon = Icon.Printer, IconAlign = IconAlign.Top, Text = "Print" });
grpOutput.Items.Add(new Button { Icon = Icon.Layout, IconAlign = IconAlign.Top, Text = "Preview" });
toolbar.Items.Add(grpSave);
toolbar.Items.Add(grpOutput);
toolbar.Items.Add(new ToolbarFill());
}
@(X.ResourceManager())
@(
X.Window().Width(400).Height(200)
.DockedItems(toolbar)
.Items(
X.FormPanel().Border(false).PaddingSpec("5 0 0 5")
.Items(
X.TextField().FieldLabel("Label 1").Listeners(l => l.Blur.Handler = "console.log('BLUR_1')").AutoFocus(true),
X.TextField().FieldLabel("Label 2").Listeners(l => l.Blur.Handler = "console.log('BLUR_2')")
)
)
)
Mentioned design works perfectly with one problem - clicking the button in the Save group or on the ToolbarFill, it does not trigger a blur event on the input fields. Please try the following:1. Code unchanged - blur event is triggered only after clicking on buttons in the Output group.
2. Comment out
grpSave.LayoutConfig
- the blur event is fired on both toolbar groups but still not on ToolbarFill
.3. Put
grpSave.LayoutConfig
back into the game and comment out the BoxReorderer
plugin - everything works as expected.I definitely need
LayoutConfig
settings for toolbar groups, so in the worst case I can sacrifice the plug-in to make it work.But why is it behaves this way and is there any work-around to preserve all the features and still be able to capture blur events on the input fields?
Thank you for your assistance.
Kind regards
Dan
Last edited by fabricio.murta; Aug 26, 2019 at 7:18 PM.