1

How do I go about changing the position and dimensions of a submit button in smalltalk/squeak? This is what I have so far:

submitButton: aModel

 ^PluggableButtonSpec new
    model: aModel;  
    label: 'submit';
    action: #submitName;
    yourself 

When I open a window in squeak, the button is really small and positioned in the upper left-hand position (the default position I assume).

Mahmud Adam
  • 3,489
  • 8
  • 33
  • 54

1 Answers1

1

This is the way I would find out:

You are using the class PluggableButtonSpec. Browse that (select the word, cmd-B/ctrl-B). That is a class in the package ToolBuilder-Kernel. I notice that it is a subclass of PluggableWidgetSpec. That seems to offer some layout related methods, like frame, margin, minimumExtent, padding, horizontalResizing (the setter has as comment "#rigid, #spaceFill, #shrinkWrap") and verticalResizing.

Perhaps I can find some examples of how these are actually used? Select PluggableButtonMorph and type ctrl-shift-N to get the class refs (or use the right-click menu). Hmm, the only user is ToolBuilder>pluggableButtonSpec. If I then click on the senders button in the class refs window, I get a window showing the 20 senders of #pluggableButtonSpec.

The first one is probably a good example, as it shows how the button bar in the class pane of the code browser is build. It uses a panel with a horizontal layout of its children. Then it creates the three buttons, of which the one with '?' gets shrink wrapped (just enough space to fit). These get added to the panel with a spacer between them. The result is a panel where two buttons divide up the resulting space, a spacer and a small button.

The other ones show the use of different layout methods.

Stephan Eggermont
  • 15,847
  • 1
  • 38
  • 65