-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WiP Widget: spinner #150
base: master
Are you sure you want to change the base?
WiP Widget: spinner #150
Conversation
May this just be a limitation in the button implementation? Button is custom-implemented, so it might be easy to change how it behaves for SWT.UP / SWT.DOWN flags.
It looks as if the text widget on Linux is not initialized with proper default values (insufficient height), so it might be a limitation of the custom-imlemented Text widget. In any case, the Text widget should probably be defined to vertically fill the overall layout. The question is how the proper size for a Spinner should be defined: Do the defaults of the Text widget define the size so that the buttons have to adapt? Do the Button defaults define the size and the Text has to adapt? Or does it define its own defaults and both contained widgets have to fit into it? I have no answer to it, so take this as a pointer. Probably taking a look at how the native widgets behave could give some reasonable indication. |
Maybe it's because of the used GridLayout, which is not configured and thus mostly uses default values (which, if I am not mistakes, includes several margins). |
Initial implementation
I added some more layout/layout data to it and it looks better now. I am using this modified version of public class Snippet184 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Snippet 184");
Spinner spinner = new Spinner (shell, SWT.BORDER);
spinner.setMinimum(0);
spinner.setMaximum(1000);
spinner.setSelection(500);
spinner.setIncrement(1);
spinner.setPageIncrement(100);
shell.setLayout(new GridLayout(1, false));
spinner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
shell.setSize(300, 300);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
} |
BTW, on Linux the spinner looks like |
Initial implementation of the
Spinner
. I am testing it withSnippet184
:Linux (WSL)

Windows

FIXME
Text::addVerifyListener
is not properly hooked right now. --> Added to Limitations of custom widget implementations #128Any hints are appreciated!