MCPcopy
hub / github.com/lxn/walk / Create

Method Create

declarative/mainwindow.go:63–200  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61}
62
63func (mw MainWindow) Create() error {
64 w, err := walk.NewMainWindowWithCfg(&walk.MainWindowCfg{
65 Name: mw.Name,
66 Bounds: mw.Bounds.toW(),
67 })
68 if err != nil {
69 return err
70 }
71
72 if mw.AssignTo != nil {
73 *mw.AssignTo = w
74 }
75
76 fi := formInfo{
77 // Window
78 Background: mw.Background,
79 ContextMenuItems: mw.ContextMenuItems,
80 DoubleBuffering: mw.DoubleBuffering,
81 Enabled: mw.Enabled,
82 Font: mw.Font,
83 MaxSize: mw.MaxSize,
84 MinSize: mw.MinSize,
85 Name: mw.Name,
86 OnBoundsChanged: mw.OnBoundsChanged,
87 OnKeyDown: mw.OnKeyDown,
88 OnKeyPress: mw.OnKeyPress,
89 OnKeyUp: mw.OnKeyUp,
90 OnMouseDown: mw.OnMouseDown,
91 OnMouseMove: mw.OnMouseMove,
92 OnMouseUp: mw.OnMouseUp,
93 OnSizeChanged: mw.OnSizeChanged,
94 RightToLeftReading: mw.RightToLeftReading,
95 Visible: mw.Visible,
96 Accessibility: mw.Accessibility,
97
98 // Container
99 Children: mw.Children,
100 DataBinder: mw.DataBinder,
101 Layout: mw.Layout,
102
103 // Form
104 Icon: mw.Icon,
105 Title: mw.Title,
106 }
107
108 builder := NewBuilder(nil)
109
110 w.SetSuspended(true)
111 if !mw.SuspendedUntilRun {
112 builder.Defer(func() error {
113 w.SetSuspended(false)
114 return nil
115 })
116 }
117
118 builder.deferBuildMenuActions(w.Menu(), mw.MenuItems)
119
120 if err := w.SetRightToLeftLayout(mw.RightToLeftLayout); err != nil {

Callers 1

RunMethod · 0.95

Calls 15

DeferMethod · 0.95
deferBuildMenuActionsMethod · 0.95
InitWidgetMethod · 0.95
deferBuildActionsMethod · 0.95
NewBuilderFunction · 0.85
ToolBarMethod · 0.80
SetToolBarMethod · 0.80
StatusBarMethod · 0.80
SizeFrom96DPIMethod · 0.80
SetImageListMethod · 0.80
DropFilesMethod · 0.80
SetSuspendedMethod · 0.65

Tested by

no test coverage detected