@@ -98,6 +98,7 @@ public class Spinner extends Composite {
9898 */
9999public Spinner (Composite parent , int style ) {
100100 super (parent , checkStyle (style ));
101+ increment = 1 ;
101102}
102103/*
103104int callWindowProc (int hwnd, int msg, int wParam, int lParam) {
@@ -182,8 +183,12 @@ protected void createHandle () {
182183 */
183184 handle = document .createElement ("DIV" );
184185 handle .className = "spinner-default" ;
185- if (parent != null && parent .handle != null ) {
186- parent .handle .appendChild (handle );
186+
187+ if (parent != null ) {
188+ Element parentHandle = parent .containerHandle ();
189+ if (parentHandle != null ) {
190+ parentHandle .appendChild (handle );
191+ }
187192 }
188193
189194 if ((style & SWT .BORDER ) != 0 ) {
@@ -199,7 +204,7 @@ protected void createHandle () {
199204 upBtnHandle .onclick = new RunnableCompatibility () {
200205
201206 public void run () {
202- setSelection (getSelection () + increment , true );
207+ setSelection (getSelection () + increment );
203208 }
204209
205210 };
@@ -210,7 +215,7 @@ public void run() {
210215 downBtnHandle .onclick = new RunnableCompatibility () {
211216
212217 public void run () {
213- setSelection (getSelection () - increment , true );
218+ setSelection (getSelection () - increment );
214219 }
215220
216221 };
@@ -221,12 +226,11 @@ public void run() {
221226 textInputHandle = document .createElement ("INPUT" );
222227 textInputHandle .className = "spinner-text-field-default" ;
223228 textHandle .appendChild (textInputHandle );
224-
229+ setSelection ( 0 , false );
225230 textInputHandle .onchange = new RunnableCompatibility () {
226231
227232 public void run () {
228- // TODO Auto-generated method stub
229-
233+ setSelection (getSelection ());
230234 }
231235
232236 };
@@ -1044,15 +1048,17 @@ public void setPageIncrement (int value) {
10441048 */
10451049public void setSelection (int value ) {
10461050 checkWidget ();
1047- int [] max = new int [1 ], min = new int [1 ];
1048- //OS.SendMessage (hwndUpDown , OS.UDM_GETRANGE32, min, max);
1049- value = Math .min (Math .max (min [0 ], value ), max [0 ]);
1051+ //OS.SendMessage (hwndUpDown , OS.UDM_GETRANGE32, min, max);
1052+ System .out .println ();
1053+ value = Math .min (Math .max (minimum , value ), maximum );
1054+
10501055 setSelection (value , false );
10511056}
10521057
10531058void setSelection (int value , boolean notify ) {
10541059 //OS.SendMessage (hwndUpDown , OS.IsWinCE ? OS.UDM_SETPOS : OS.UDM_SETPOS32, 0, value);
10551060 String string = String .valueOf (value );
1061+ System .out .println ("Spinner value " + value + " " + digits );
10561062 if (digits > 0 ) {
10571063 String decimalSeparator = getDecimalSeparator ();
10581064 int index = string .length () - digits ;
@@ -1069,10 +1075,13 @@ void setSelection (int value, boolean notify) {
10691075 }
10701076 string = buffer .toString ();
10711077 }
1078+
10721079 if (hooks (SWT .Verify ) || filters (SWT .Verify )) {
10731080 //int length = OS.GetWindowTextLength (hwndText);
10741081 int length = textInputHandle .value .length ();
1082+ System .out .println ("Spinner set text of " + length );
10751083 string = verifyText (string , 0 , length , null );
1084+ System .out .println ("Spinner set text of 2" + string );
10761085 if (string == null ) return ;
10771086 }
10781087 if (textInputHandle != null ) {
@@ -1139,8 +1148,19 @@ public void setSize(int width, int height) {
11391148 super .setSize (width , height );
11401149 textInputHandle .style .width = (width - 28 ) + "px" ;
11411150 textInputHandle .style .height = ((height - 2 ) > 24 ? 20 : height - 2 ) + "px" ;
1151+ System .out .println ("width " + width + " px " + textInputHandle .style .width
1152+ + " heigth " + height + " " + textInputHandle .style .height );
11421153}
1154+ void setBounds (int x , int y , int width , int height , int flags ) {
1155+ super .setBounds (x , y , width , height , flags );
1156+ System .out .println ("Spinner set bounds called on " + x + " " + y + " " + width + " " + height );
1157+ System .out .println ("width " + width + " px " + textInputHandle .style .width
1158+ + " heigth " + height + " " + textInputHandle .style .height );
11431159
1160+ textInputHandle .style .width = (width - 28 ) + "px" ;
1161+ textInputHandle .style .height = ((height - 2 ) > 24 ? 20 : height - 2 ) + "px" ;
1162+
1163+ }
11441164/*
11451165int widgetExtStyle () {
11461166 return super.widgetExtStyle () & ~OS.WS_EX_CLIENTEDGE;
0 commit comments