Снова вернулся к старой задаче, на этот раз решить часть проблемы удалось. Идея была в создании одного окна для ввода текста. Вчера вечером помаялся порядком, сегодня добавил еще одну фичу: смена цвета окна.Осталось придумать, как перемещать окошко.
Global hWndRet
Global oldEditProcedure
Global BackBrush=CreateSolidBrush_(#Green)
Procedure WindowProcedure(hwnd, message, wParam, lParam)
Select message
Case #WM_CTLCOLOREDIT
SetBkMode_(wParam,#TRANSPARENT)
SetTextColor_(wParam,#Red)
; SetBkColor_(wParam,#Blue)
ProcedureReturn BackBrush
; SetTextColor_(wParam,$00007F)
; SetBkColor_(wParam,$000000)
; ProcedureReturn GetSysColorBrush_(#COLOR_3DHILIGHT )
;ProcedureReturn GetStockObject_(#NULL_BRUSH)
Case #WM_NCCALCSIZE
*lp.RECT
*lp=lParam
*lp\bottom=*lp\top+18
Case #WM_CHAR
;Debug wParam
EndSelect
;ProcedureReturn DefWindowProc_(hwnd, message, wParam, lParam)
ProcedureReturn CallWindowProc_(oldEditProcedure, hwnd, message, wParam, lParam)
EndProcedure
;https://stackoverflow.com/questions/16633860/win32-api-how-to-make-edit-text-to-accept-unsigned-float-only-in-c
hInstance=GetModuleHandle_(0)
hWndRet = CreateWindowEx_(#WS_EX_CLIENTEDGE, "Edit", "EditText", #WS_VISIBLE | #ES_LEFT |#ES_AUTOHSCROLL, 0, 0, 10, 10, 0, 0, hInstance, 0);
oldEditProcedure = GetWindowLongPtr_(hWndRet, #GWLP_WNDPROC) ;
SetWindowLongPtr_(hWndRet, #GWLP_WNDPROC, @WindowProcedure()) ;
SetBkColor_(GetDC_(hWndRet), RGB(255, 255, 255))
lStyle = GetWindowLong_(hWndRet, #GWL_STYLE);
lStyle = lStyle & ~#WS_CAPTION
lStyle = lStyle & ~#WS_BORDER
SetWindowLong_(hWndRet, #GWL_STYLE, lStyle) ;
SendMessage_(hWndRet,#WM_SETFONT,GetStockObject_(#DEFAULT_GUI_FONT),1)
SetWindowPos_(hWndRet, 0, 60,60,100,10, #SWP_FRAMECHANGED | #SWP_NOZORDER | #SWP_NOOWNERZORDER);
MoveWindow_(hWndRet,0,0,80,18,1)
If OpenWindow(0, 100, 200, 195, 260, "Blank Edit control", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf
DeleteObject_(BackBrush)
Global oldEditProcedure
Global BackBrush=CreateSolidBrush_(#Green)
Procedure WindowProcedure(hwnd, message, wParam, lParam)
Select message
Case #WM_CTLCOLOREDIT
SetBkMode_(wParam,#TRANSPARENT)
SetTextColor_(wParam,#Red)
; SetBkColor_(wParam,#Blue)
ProcedureReturn BackBrush
; SetTextColor_(wParam,$00007F)
; SetBkColor_(wParam,$000000)
; ProcedureReturn GetSysColorBrush_(#COLOR_3DHILIGHT )
;ProcedureReturn GetStockObject_(#NULL_BRUSH)
Case #WM_NCCALCSIZE
*lp.RECT
*lp=lParam
*lp\bottom=*lp\top+18
Case #WM_CHAR
;Debug wParam
EndSelect
;ProcedureReturn DefWindowProc_(hwnd, message, wParam, lParam)
ProcedureReturn CallWindowProc_(oldEditProcedure, hwnd, message, wParam, lParam)
EndProcedure
;https://stackoverflow.com/questions/16633860/win32-api-how-to-make-edit-text-to-accept-unsigned-float-only-in-c
hInstance=GetModuleHandle_(0)
hWndRet = CreateWindowEx_(#WS_EX_CLIENTEDGE, "Edit", "EditText", #WS_VISIBLE | #ES_LEFT |#ES_AUTOHSCROLL, 0, 0, 10, 10, 0, 0, hInstance, 0);
oldEditProcedure = GetWindowLongPtr_(hWndRet, #GWLP_WNDPROC) ;
SetWindowLongPtr_(hWndRet, #GWLP_WNDPROC, @WindowProcedure()) ;
SetBkColor_(GetDC_(hWndRet), RGB(255, 255, 255))
lStyle = GetWindowLong_(hWndRet, #GWL_STYLE);
lStyle = lStyle & ~#WS_CAPTION
lStyle = lStyle & ~#WS_BORDER
SetWindowLong_(hWndRet, #GWL_STYLE, lStyle) ;
SendMessage_(hWndRet,#WM_SETFONT,GetStockObject_(#DEFAULT_GUI_FONT),1)
SetWindowPos_(hWndRet, 0, 60,60,100,10, #SWP_FRAMECHANGED | #SWP_NOZORDER | #SWP_NOOWNERZORDER);
MoveWindow_(hWndRet,0,0,80,18,1)
If OpenWindow(0, 100, 200, 195, 260, "Blank Edit control", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_CloseWindow
Quit = 1
EndIf
Until Quit = 1
EndIf
DeleteObject_(BackBrush)
Комментарии
Отправить комментарий