Simulate Terminal in an EditorGadget
Posted: Fri Feb 23, 2024 6:24 pm
hi
i'm trying to simulate Windows terminal behaviour inside an EditorGadget, so far i've done this :
Now i need two things :
1 - Limite characters deletion using backspace until a certain position (position of the prompt "c:\>" for instance)
2 - Detect when user presses Enter.
Thanks
i'm trying to simulate Windows terminal behaviour inside an EditorGadget, so far i've done this :
Code: Select all
EnableExplicit
Define EventID
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(1, 0, 0, 500, 400, #PB_Editor_WordWrap)
SetGadgetText(1, "Windows Terminal Simulation")
SetGadgetColor(1, #PB_Gadget_BackColor, 0)
SetGadgetColor(1, #PB_Gadget_FrontColor, $C0C0C0)
SetGadgetFont(1, FontID(LoadFont(#PB_Any, "lucida console", 11)))
SetActiveGadget(1)
SendMessage_(GadgetID(1), #EM_SETSEL, $fffffff, $fffffff)
Repeat
EventID = WaitWindowEvent()
If EventID = #WM_KEYDOWN And EventWindow() = 0
SendMessage_(GadgetID(1), #EM_SETSEL, $fffffff, $fffffff)
EndIf
If EventID = #PB_Event_CloseWindow
End
EndIf
ForEver
EndIf
1 - Limite characters deletion using backspace until a certain position (position of the prompt "c:\>" for instance)
2 - Detect when user presses Enter.
Thanks