Scale not shown
Tower Ty
tytower at hotmail.com.au
Thu Jun 19 13:57:28 PDT 2008
yidabu Wrote:
>
>
> dwt-samples\jface\ShowFieldPrefs.d works fine before. but I build it today with same command, the Scale widget not shown.
>
> I create a test code, Scale not shown:
You seem to have one on top of the other
Try this
module SliderTest;
import dwt.DWT;
import dwt.events.SelectionAdapter;
import dwt.events.SelectionEvent;
import dwt.widgets.Display;
import dwt.widgets.Shell;
import dwt.widgets.Scale;
import dwt.widgets.Slider;
import dwt.dwthelper.utils;
import tango.util.log.Trace;
void main()
{
SliderTest.main(null);
}
public class SliderTest {
public static void main(char[][] args) {
Display display = new Display();
Shell shell = new Shell(display);
//Slider
final Slider slider = new Slider(shell, DWT.HORIZONTAL);
slider.setBounds(50, 50, 200, 32);
slider.setMinimum(0);
slider.setMaximum(100);
slider.setThumb(5);
slider.addSelectionListener(new class() SelectionAdapter {
public void widgetSelected(SelectionEvent e) {
Trace.formatln("Slider Selection: {}" ,slider.getSelection());
}
});
//Scale
final Scale scale = new Scale(shell, DWT.HORIZONTAL);
scale.setBounds(10, 50, 200, 72, 0,true);
scale.setMinimum(0);
scale.setMaximum(100);
scale.addSelectionListener(new class SelectionAdapter {
public void widgetSelected(SelectionEvent e) {
Trace.formatln("Scale Selection:{}" , scale.getSelection());
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
More information about the Digitalmars-d-dwt
mailing list