03-18-2013, 07:03 AM
<< is bitwise left-shift operator. Like in C++ and other languages. Here I used it to make code smaller, avoid multiple but(...).
1<<1 = 2
1<<2 = 4
1<<3 = 8
1<<4 = 16
...
1<<16 = 0x10000
...
1<<31 = 0x80000000
EN_SETFOCUS<<16|14 creates value where high-order word is EN_SETFOCUS and low-order word is 14.
Try smaller timer period. For example, with period 1 almost no lag. Actually OS does not allow 1 s period, smallest is maybe 10 ms. The timer goes all the time, but the code is fast, still 0 % CPU in Task Manager.
But probably better is to execute gTimer code on messages that dialog receives when splitter moved, dialog moved etc. Use OutWinMsg to see messages. For example:
,case [WM_PAINT,WM_MOVE] goto gTimer
To center buttons better use WM_SIZE, but can also do it on WM_TIMER, if the code is fast. Don't mov everytime, only when need, like I did with memcmp, then much faster.
To limit splitter range, use other smaller control by the splitter.
Function Dialog122
1<<1 = 2
1<<2 = 4
1<<3 = 8
1<<4 = 16
...
1<<16 = 0x10000
...
1<<31 = 0x80000000
EN_SETFOCUS<<16|14 creates value where high-order word is EN_SETFOCUS and low-order word is 14.
Try smaller timer period. For example, with period 1 almost no lag. Actually OS does not allow 1 s period, smallest is maybe 10 ms. The timer goes all the time, but the code is fast, still 0 % CPU in Task Manager.
But probably better is to execute gTimer code on messages that dialog receives when splitter moved, dialog moved etc. Use OutWinMsg to see messages. For example:
,case [WM_PAINT,WM_MOVE] goto gTimer
To center buttons better use WM_SIZE, but can also do it on WM_TIMER, if the code is fast. Don't mov everytime, only when need, like I did with memcmp, then much faster.
To limit splitter range, use other smaller control by the splitter.
Function Dialog122
\Dialog_Editor
if(!ShowDialog("Dialog122")) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 QM_Splitter 0x54030000 0x0 4 56 214 6 ""
;4 Edit 0x54030080 0x200 2 0 110 54 ""
;5 Static 0x54000000 0x0 118 26 96 28 "This smaller control limits splitter range."
;6 Static 0x54000000 0x0 2 64 212 14 "A splitter is above me. Try to drag it up."
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030502 "" "" "" ""