MCPcopy Create free account
hub / github.com/lxn/walk / SetDefaultButtonWidth

Method SetDefaultButtonWidth

toolbar.go:185–207  ·  view source on GitHub ↗

SetDefaultButtonWidth sets the default button width of the ToolBar. Calling this method affects all buttons in the ToolBar, no matter if they are added before or after the call. A width of 0 results in automatic sizing behavior. Negative values are not allowed.

(width int)

Source from the content-addressed store, hash-verified

183// added before or after the call. A width of 0 results in automatic sizing
184// behavior. Negative values are not allowed.
185func (tb *ToolBar) SetDefaultButtonWidth(width int) error {
186 if width == tb.defaultButtonWidth {
187 return nil
188 }
189
190 if width < 0 {
191 return newError("width must be >= 0")
192 }
193
194 old := tb.defaultButtonWidth
195
196 tb.defaultButtonWidth = width
197
198 for _, action := range tb.actions.actions {
199 if err := tb.onActionChanged(action); err != nil {
200 tb.defaultButtonWidth = old
201
202 return err
203 }
204 }
205
206 return tb.applyDefaultButtonWidth()
207}
208
209func (tb *ToolBar) MaxTextRows() int {
210 return tb.maxTextRows

Callers

nothing calls this directly

Calls 3

onActionChangedMethod · 0.95
newErrorFunction · 0.85

Tested by

no test coverage detected