Changeset 18
- Timestamp:
- 02/18/08 01:43:59 (7 months ago)
- Files:
-
- trunk/win32/dfl/button.d (modified) (1 diff)
- trunk/win32/dfl/control.d (modified) (2 diffs)
- trunk/win32/dfl/form.d (modified) (3 diffs)
- trunk/win32/dfl/label.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/win32/dfl/button.d
r7 r18 231 231 //return GetDlgCtrlID(m.hWnd) == IDOK; 232 232 return isdef; 233 } 234 235 236 protected override bool processMnemonic(dchar charCode) 237 { 238 if(canSelect) 239 { 240 if(isMnemonic(charCode, text)) 241 { 242 select(); 243 //performClick(); 244 onClick(EventArgs.empty); 245 return true; 246 } 247 } 248 return false; 233 249 } 234 250 trunk/win32/dfl/control.d
r17 r18 3710 3710 return; 3711 3711 3712 // To-do: check if correct implementation. 3712 3713 Control ctrl; 3713 3714 if( directed)3715 { 3716 SendMessageA(hwnd, WM_NEXTDLGCTL, !forward, MAKELPARAM(false, 0)); // TODO: fix...3717 /+3718 ctrl = Control.fromChildHandle(GetFocus());3719 if(ctrl)3720 {3721 ctrl = getNextControl(ctrl, forward, true);3722 if(ctrl)3723 ctrl.select();3724 }3725 +/3714 ctrl = findForm(); 3715 if(ctrl && ctrl !is this) 3716 { 3717 // Even if directed, ensure THIS one is selected first. 3718 if(!directed || hwnd != GetFocus()) 3719 { 3720 DefDlgProcA(ctrl.handle, WM_NEXTDLGCTL, cast(WPARAM)hwnd, MAKELPARAM(true, 0)); 3721 } 3722 3723 if(directed) 3724 { 3725 DefDlgProcA(ctrl.handle, WM_NEXTDLGCTL, !forward, MAKELPARAM(false, 0)); 3726 } 3726 3727 } 3727 3728 else 3728 3729 { 3729 ctrl = findForm(); 3730 if(ctrl && ctrl !is this) 3731 { 3732 //SendMessageA(ctrl.handle, WM_NEXTDLGCTL, cast(WPARAM)hwnd, MAKELPARAM(true, 0)); 3733 DefDlgProcA(ctrl.handle, WM_NEXTDLGCTL, cast(WPARAM)hwnd, MAKELPARAM(true, 0)); 3734 } 3735 else 3736 { 3737 focus(); // This must be a form so just focus it ? 3738 } 3730 focus(); // This must be a form so just focus it ? 3739 3731 } 3740 3732 } … … 6530 6522 6531 6523 6532 / +6533 deprecatedprotected bool processMnemonic(dchar charCode)6524 /// 6525 protected bool processMnemonic(dchar charCode) 6534 6526 { 6535 6527 return false; 6536 6528 } 6537 +/ 6529 6530 6531 package bool _processMnemonic(dchar charCode) 6532 { 6533 return processMnemonic(charCode); 6534 } 6538 6535 6539 6536 trunk/win32/dfl/form.d
r16 r18 2743 2743 return false; 2744 2744 2745 case Keys.UP, Keys.DOWN: 2746 case Keys.RIGHT, Keys.LEFT: 2747 if(dfl.internal.utf.isDialogMessage(form.handle, &m._winMsg)) 2748 return true; // Prevent. 2749 return false; // Continue. 2750 2745 2751 case Keys.TAB: 2746 2752 { … … 2791 2797 } 2792 2798 2799 /+ 2793 2800 switch(m.msg) 2794 2801 { … … 2815 2822 return true; // Prevent. 2816 2823 } 2824 +/ 2825 switch(m.msg) 2826 { 2827 case WM_SYSCHAR: 2828 { 2829 LRESULT dlgc; 2830 dlgc = SendMessageA(m.hWnd, WM_GETDLGCODE, 0, 0); 2831 if(dlgc & DLGC_WANTALLKEYS) 2832 return false; // Continue. 2833 2834 size_t xiter; 2835 bool _eachild(HWND hw, bool delegate(HWND hw) callback) 2836 { 2837 for(; hw; hw = GetWindow(hw, GW_HWNDNEXT)) 2838 { 2839 if(!xiter) 2840 return false; 2841 xiter--; 2842 2843 LONG st = GetWindowLongA(hw, GWL_STYLE); 2844 if(!(st & WS_VISIBLE)) 2845 continue; 2846 if(st & WS_DISABLED) 2847 continue; 2848 2849 if(!callback(hw)) 2850 return false; 2851 2852 LONG exst = GetWindowLongA(hw, GWL_EXSTYLE); 2853 if(exst & WS_EX_CONTROLPARENT) 2854 { 2855 HWND hwc = GetWindow(hw, GW_CHILD); 2856 if(hwc) 2857 { 2858 if(!_eachild(hwc, callback)) 2859 return false; 2860 } 2861 } 2862 } 2863 return true; 2864 } 2865 2866 void eachGoodChild(bool delegate(HWND hw) callback) 2867 { 2868 HWND hw = GetWindow(form.handle, GW_CHILD); 2869 xiter = 2000; 2870 _eachild(hw, callback); 2871 } 2872 2873 bool pmnemonic(HWND hw) 2874 { 2875 Control cc = Control.fromHandle(hw); 2876 //printf("mnemonic for "); 2877 if(!cc) 2878 { 2879 // To-do: check dlgcode for static/button and process. 2880 return false; 2881 } 2882 //printf("'%.*s' ", cc.name); 2883 return cc._processMnemonic(cast(dchar)m.wParam); 2884 } 2885 2886 bool foundmhw = false; 2887 bool foundmn = false; 2888 eachGoodChild( 2889 (HWND hw) 2890 { 2891 if(foundmhw) 2892 { 2893 if(pmnemonic(hw)) 2894 { 2895 foundmn = true; 2896 return false; // Break. 2897 } 2898 } 2899 else 2900 { 2901 if(hw == m.hWnd) 2902 foundmhw = true; 2903 } 2904 return true; // Continue. 2905 }); 2906 if(foundmn) 2907 return true; // Prevent. 2908 2909 if(!foundmhw) 2910 { 2911 // Didn't find current control, so go from top-to-bottom. 2912 eachGoodChild( 2913 (HWND hw) 2914 { 2915 if(pmnemonic(hw)) 2916 { 2917 foundmn = true; 2918 return false; // Break. 2919 } 2920 return true; // Continue. 2921 }); 2922 } 2923 else 2924 { 2925 // Didn't find mnemonic after current control, so go from top-to-this. 2926 eachGoodChild( 2927 (HWND hw) 2928 { 2929 if(pmnemonic(hw)) 2930 { 2931 foundmn = true; 2932 return false; // Break. 2933 } 2934 if(hw == m.hWnd) 2935 return false; // Break. 2936 return true; // Continue. 2937 }); 2938 } 2939 if(foundmn) 2940 return true; // Prevent. 2941 } 2942 break; 2943 2944 default: ; 2945 } 2817 2946 } 2818 2947 trunk/win32/dfl/label.d
r7 r18 361 361 362 362 363 protected override bool processMnemonic(dchar charCode) 364 { 365 if(visible && enabled) 366 { 367 if(isMnemonic(charCode, text)) 368 { 369 select(true, true); 370 return true; 371 } 372 } 373 return false; 374 } 375 376 363 377 private: 364 378 TextFormat _tfmt;
