Bug 95466 - modifyEvent is called inconsistently across platforms (win vs linux/gtk)
Summary: modifyEvent is called inconsistently across platforms (win vs linux/gtk)
Status: RESOLVED DUPLICATE of bug 90223
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: Other All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-16 17:36 EDT by Morten Moeller CLA
Modified: 2005-05-17 15:33 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Morten Moeller CLA 2005-05-16 17:36:41 EDT
I have a minute spinner and an hour spinner. I want the minute spinner to 
"spill over" into the hour one, so I created the code below: 
 
minuteSpinner.addModifyListener(new ModifyListener() { 
            public void modifyText(ModifyEvent e) { 
                if (minuteSpinner.getSelection() >= 60) { 
                    minuteSpinner.setSelection(0); 
                    hourSpinner.setSelection(hourSpinner.getSelection() + 1); 
                } 
            }  
        }); 
 
Problem is this works fine on Linux/GTK, but trying it on Windows modifyText 
seems to be called before the getSelection() value changes and not after like 
it does on Linux.. So on windows minutes goes up to 60 and then flips over 
while on Linux it goes up to 59 and then flips over.
Comment 1 Florian Priester CLA 2005-05-17 02:42:45 EDT
Which version of SWT are you using?
This sounds like bug 90223 which was fixed a few days after M6 came out.
Comment 2 Morten Moeller CLA 2005-05-17 10:08:22 EDT
I am indeed using M6 sorry I didn't note that. Upgrade of our application to M7
failed miserably so I cannot move there yet.

So this is probably a dupe of that bug. so it sounds like the Linux behavior is
correct and not the Windows one..
Comment 3 Felipe Heidrich CLA 2005-05-17 13:42:17 EDT
Works for me on M7. Should I close this as dupe of bug 90223 ?

Here is the testcase:
public static void main(String[] args) {
	Display  display = new Display ();
	Shell shell = new Shell (display);
	shell.setLayout(new RowLayout());
	final Spinner hourSpinner = new Spinner (shell, SWT.NONE);
	final Spinner minuteSpinner = new Spinner (shell, SWT.NONE);
	minuteSpinner.setMaximum(60);
	hourSpinner.setMaximum(12);
	minuteSpinner.setSelection(55);
	minuteSpinner.addModifyListener(new ModifyListener() { 
    public void modifyText(ModifyEvent e) { 
        if (minuteSpinner.getSelection() >= 60) { 
        		minuteSpinner.setSelection(0); 
            hourSpinner.setSelection(hourSpinner.getSelection() + 1); 
        }
    }  
	}); 
	shell.pack();
	shell.open ();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep ();
		}
	}
	display.dispose ();
}
Comment 4 Steve Northover CLA 2005-05-17 14:18:06 EDT
Is it a dup of 90233?
Comment 5 Morten Moeller CLA 2005-05-17 15:11:00 EDT
Yep, I tested this on M7 just now and it works fine. So its fixed in any case 
on M7... Sorry about that. 
Comment 6 Felipe Heidrich CLA 2005-05-17 15:24:01 EDT

*** This bug has been marked as a duplicate of 90233 ***
Comment 7 Rafael Chaves CLA 2005-05-17 15:32:34 EDT
Wrong dup.
Comment 8 Rafael Chaves CLA 2005-05-17 15:33:08 EDT
Closing again.

*** This bug has been marked as a duplicate of 90223 ***