Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 202414 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java (+55 lines)
Lines 412-417 Link Here
412
	return text;
412
	return text;
413
}
413
}
414
414
415
boolean mnemonicHit (char key) {
416
	if (mnemonics != null) {
417
		char uckey = Character.toUpperCase (key);
418
		String parsedText = parse(text);
419
		for (int i = 0; i < mnemonics.length - 1; i++) {
420
			if (mnemonics[i] != -1) {
421
				char mnemonic = parsedText.charAt(mnemonics[i]);
422
				if (uckey == Character.toUpperCase (mnemonic)) {
423
					if (!setFocus ()) return false;
424
					if (OS.COMCTL32_MAJOR >= 6) {
425
						int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
426
						LITEM item = new LITEM ();
427
						item.mask = OS.LIF_ITEMINDEX | OS.LIF_STATE;
428
						item.stateMask = OS.LIS_FOCUSED;
429
						while (item.iLink < mnemonics.length) {
430
							if (item.iLink != i) OS.SendMessage (handle, OS.LM_SETITEM, 0, item);
431
							item.iLink++;
432
						}
433
						item.iLink = i;
434
						item.state = OS.LIS_FOCUSED;
435
						OS.SendMessage (handle, OS.LM_SETITEM, 0, item);
436
						
437
						/* Feature in Windows. For some reason, setting the focus to 
438
						 * any item but first causes the control to clear the WS_TABSTOP
439
						 * bit. The fix is always to reset the bit. 
440
						 */
441
						OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
442
					} else {
443
						focusIndex = i;
444
						redraw ();
445
					}
446
					return  true;
447
				}
448
			}
449
		}
450
	}
451
	return false;
452
}
453
454
boolean mnemonicMatch (char key) {
455
	if (mnemonics != null) {
456
		char uckey = Character.toUpperCase (key);
457
		String parsedText = parse(text);
458
		for (int i = 0; i < mnemonics.length - 1; i++) {
459
			if (mnemonics[i] != -1) {
460
				char mnemonic = parsedText.charAt(mnemonics[i]);
461
				if (uckey == Character.toUpperCase (mnemonic)) { 
462
					return true;
463
				}
464
			}
465
		}
466
	}
467
	return false;
468
}
469
415
String parse (String string) {
470
String parse (String string) {
416
	int length = string.length ();
471
	int length = string.length ();
417
	offsets = new Point [length / 4];
472
	offsets = new Point [length / 4];

Return to bug 202414