==========================================================================
UndoAll.js http://akelpad.sourceforge.net/forum/viewtopic.php?p=4050#p4050
==========================================================================
var hWndEdit = AkelPad.GetEditWnd();
var oSys = AkelPad.SystemFunction();
...
...
SetRedraw(hWndEdit, false); //запретить перерисовку
AkelPad.SendMessage(hWndEdit, 3185 /*AEM_LOCKSCROLL*/, 3 /*SB_BOTH*/, true); //удерживать от перемотки
... //тут действия с изменением содержимого
AkelPad.SendMessage(hWndEdit, 3185 /*AEM_LOCKSCROLL*/, 3 /*SB_BOTH*/, false); //освободить перемотку
SetRedraw(hWndEdit, true); //разрешить перерисовку
...
...
function SetRedraw(hWnd, bRedraw)
{
AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, bRedraw, 0);
if (bRedraw) oSys.Call("user32::InvalidateRect", hWnd, 0, true);
}
======================
Можно так попробовать:
======================
SetRedraw(hWndEdit, false);
...
SetRedraw(hWndEdit, true);
...
function SetRedraw(hWnd, bRedraw)
{
AkelPad.SendMessage(hWnd, 3185 /*AEM_LOCKSCROLL*/, 3 /*SB_BOTH*/, !bRedraw);
AkelPad.SendMessage(hWnd, 11 /*WM_SETREDRAW*/, bRedraw, 0);
if (bRedraw) oSys.Call("user32::InvalidateRect", hWnd, 0, true);
}
===================================================
AkelEdit.h AEM_LOCKSCROLL (WM_USER + 2161) = 3185
===================================================
Lock scrolling of an edit control.
(int)wParam == SB_BOTH lock horizontal and vertical scroll.
SB_HORZ lock horizontal scroll.
SB_VERT lock vertical scroll.
-1 only retrieve current SB_* lock, lParam is ignored.
(BOOL)lParam == TRUE lock scroll.
FALSE unlock scroll.
Return Value
Previous SB_* lock or -1 if no locking information defined.
Remarks
Locking is cumulative. If your application locks scroll five times in a row, it must also unlock scroll five times before the scroll unlocks.
Example:
SendMessage(hWndEdit, AEM_LOCKSCROLL, SB_BOTH, TRUE);
SendMessage(hWndEdit, EM_SETSEL, (WPARAM)-1, (LPARAM)-1);
SendMessage(hWndEdit, AEM_LOCKSCROLL, SB_BOTH, FALSE);
==================================================================================
WM_SETREDRAW message
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145219%28v=vs.85%29.aspx
==================================================================================
An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn.
SendMessage(
(HWND) hWnd,
WM_SETREDRAW,
(WPARAM) wParam,
(LPARAM) lParam
);
wParam - The redraw state. If this parameter is TRUE, the content can be redrawn after a change. If this parameter is FALSE, the content cannot be redrawn after a change.
lParam - This parameter is not used.
Return value
An application returns zero if it processes this message.
==================================================================================
InvalidateRect function
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145002%28v=vs.85%29.aspx
==================================================================================
The InvalidateRect function adds a rectangle to the specified window's update region. The update region represents the portion of the window's client area that must be redrawn.
BOOL InvalidateRect(
__in HWND hWnd,
__in const RECT *lpRect,
__in BOOL bErase
);
hWnd [in] - A handle to the window whose update region has changed. If this parameter is NULL, the system invalidates and redraws all windows, not just the windows for this application, and sends the WM_ERASEBKGND and WM_NCPAINT messages before the function returns. Setting this parameter to NULL is not recommended.
lpRect [in] - A pointer to a RECT structure that contains the client coordinates of the rectangle to be added to the update region. If this parameter is NULL, the entire client area is added to the update region.
bErase [in] - Specifies whether the background within the update region is to be erased when the update region is processed. If this parameter is TRUE, the background is erased when the BeginPaint function is called. If this parameter is FALSE, the background remains unchanged.
Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Posted: Mon Jul 30, 2012 1:35 pm
by Andrey_A_A
Visitor7, спасибо!
SetRedraw я уже использовал, а про это не знал
AkelPad.SendMessage(hWndEdit, 3185 /*AEM_LOCKSCROLL*/, 3 /*SB_BOTH*/, true); //удерживать от перемотки
... //тут действия с изменением содержимого
AkelPad.SendMessage(hWndEdit, 3185 /*AEM_LOCKSCROLL*/, 3 /*SB_BOTH*/, false); //освободить перемотку
Posted: Tue Jul 31, 2012 11:51 am
by KDJ
I need the handle to the new edit window (after IDM_FILE_CREATENEW command).
The following script works in SDI and PMDI mode.
In MDI doesn't work (hNewEditWnd = 0).
How to do it in MDI?
KDJ
In PMDI mode "hNewEditWnd = 0" too.
Did you mean not "hNewEditWnd" but "hNewMainWnd"?
So maybe answer is: IDM_OPTIONS_SINGLEOPEN_PROGRAM (MENUITEM "Don't open a program twice"). Becouse (4102 = Create new instance of program)
Posted: Tue Jul 31, 2012 4:11 pm
by Instructor
KDJ
hMainWnd is not parent for edit windows in MDI mode.
Хм, а сделать, чтоб при коде выхода 0 вместо панели просто показывался MessageBox? Вывод-то туда можно не запрещать: программа и сама ничего не выводит, если нет ошибок.
var WshShell = new ActiveXObject("WScript.Shell");
if (WshShell.Run(pCommand, 0) == 0) AkelPad.MessageBox(hMainWnd, "Готово", WScript.ScriptName, 0 /*MB_OK*/);
else runLogOutputCmd(pCommand, "");
Posted: Sat Aug 04, 2012 10:18 pm
by KDJ
Translator.js
Added:
- options in context menu.
- Ctrl+W - source window on/off,
- other shortcut keys, see in context menu.
Changed:
- Alt+Enter - works as Ctrl+Enter, but translated text will be added at the end in target window,
- Shift+Enter - translates selected text.
Fixed: small bugs.