PDA

View Full Version : Accessing and modifying the Debug Window


Eagle
08-10-2007, 10:28 PM
The Debug Window is a buitin handy resource to tap into while
still enabling the end user to interact with your main APP
here's a couple of code chuncks to customise the debug window

some global funcs:

function SetDebugHwnd(wndTitleIn,SetwndTitle)

--to set or change the Title of the builtin 'debug window' and get and return its Window Handle for future use

local tHwnds = Window.EnumerateTitles(false);
for hWnd, wtitle in tHwnds do
if (String.CompareNoCase(wtitle, wndTitleIn) == 0) then
if (String.ToNumber(DLL.CallFunction(_SystemFolder.."\\user32.dll", "GetParent", hWnd, 1, 1)) == Application.GetWndHandle()) then
Window.SetText(hWnd, SetwndTitle); return hWnd; --set title and return the debug handle
end
end
end
end


function IsDebugActive(nHwnd)

--to discover if the debug window is the current active window

if (String.ToNumber(DLL.CallFunction(_SystemFolder.."\\User32.dll", "GetActiveWindow", "", 1, 1)) == nHwnd) then
return true;
end
return false;
end

some example calls:

nDBHwnd = SetDebugHwnd("Debug","- Information -"); -- a global var

if (not IsDebugActive(nDBHwnd)) then
--do something here
end

if IsDebugActive(nDBHwnd) then
--do something here
end


Window.SetSize(nDBHwnd, 500, 350);
--get or set the text you wish to display in the debug window
local sText = "Display this string in the debug window";
--local sText = TextFile.ReadToString("FullpathandFilename");
Debug.Clear(); Debug.Print(sText); Debug.ShowWindow(true);

have a play and modify to suit

I've also put in a request to control the 'right click' functionality here:

http://www.indigorose.com/forums/showthread.php?t=20954

WebCyb
08-18-2008, 08:49 PM
Thanks Eagle, it's useful :yes