//************************************************************************ //*** Debug info panel. //************************************************************************ //*** Debug_box.pkg //*** Version: 1.2 //*** Copyright (c) 2002 NordTeam Gruppen //*** //*** Author......: Allan Kim Eriksen //*** Created.....: 17/06 2002 //*** Last updated: 05/07 2002 //************************************************************************ // This Debug_box, can be used in sted of info_box. It is more practical // to use this because it is more easy to find af remove theese calls than // calls to the info_box (The info_box can be used permanently in your // application) before compiling the application to the enduser. // Thurther more there is an extra button called "Kill" that can be used // to terminate the application. That is usefull if you have the debug_box // call inside a loop. // The debug_box remembers it position every time you close the debog_box // unless you use the Kill-button. // Thurther more it lists the length of the messagestring in bytes in the // caption-bar of the debug_box. Usefull when you are debugging string // that may contain spaces. // // Use it like this: // // Send Debug_box "Text" // // NOTE! Do not try to send debug_box BEFORE start_UI has been executed. // Otherwuse it will make your application freeze when closing the // debug_box again. // Global integers for saving and restoring the original indicators. Integer giDebugOldFound giDebugOldFindErr giDebugOldLastErr Object Debug_panel is a ToolPanel set size to 50 50 Set label to "*Debug info*" Set sysmenu_icon to false Set Border_Style to border_dialog Set locate_mode to NO_LOCATE Object Debug_text is a textbox Set justification_mode to jMode_Left Set auto_size_state to True set size to 10 10 set location to 10 10 end_object Object cmdOk is a Button Set size to 14 50 Set location to 30 25 Set default_State to True Set label to "Ok" Procedure OnClick Send Close_panel end_procedure end_object Object cmdKill is a Button set size to 14 50 set location to 30 30 set label to "Kill" Procedure OnClick abort end_procedure end_object Procedure Popup Local string sTekst Local integer iCsize iXsize iYsize Local integer iLuft iButtonBund Get Size of (Debug_text(self)) to iCsize Move (hi(iCsize)) to iYsize Move (low(iCsize)) to iXsize if (iYsize > 350) move 350 to iYsize if (iXsize > 600) move 600 to iXsize Set size of (Debug_text(self)) to iYsize iXsize move (iYsize + 50) to iYsize Move (iXsize + 20) to iXsize if (iySize < 70) move 70 to iYsize if (iXsize < 150) move 150 to iXsize Set size to iYsize iXsize move ((iXsize - 100)/3) to iLuft move (iYsize - 40) to iButtonBund Set location of (cmdOk(self)) to iButtonBund iLuft Set location of (cmdKill(self)) to iButtonBund (iLuft+50+iLuft) Get_profile_string "Defaults" "Debug_box X-pos" to iXsize Get_profile_string "Defaults" "Debug_box Y-pos" to iYsize Set Location to iYsize iXsize Forward send Popup Get Location to iCsize Move (hi(iCsize)) to iYsize Move (low(iCsize)) to iXsize Set_profile_string "Defaults" "Debug_box X-pos" to iXsize Set_profile_string "Defaults" "Debug_box Y-pos" to iYsize end_procedure end_object Procedure Debug_box string sInfo Move (Found) To giDebugOldFound // save the original indicators so that the debug_box Move (FindErr) To giDebugOldFindErr // will not mess up the program Move (LastErr) To giDebugOldLastErr // (thanks til Wil van Antwerpen for the notification) move (Replaces("\n", sInfo, (Character(13)))) to sInfo Set label of (Debug_text(Debug_panel(self))) to sInfo Set label of (Debug_panel(self)) to ("*DEBUG INFO* Messagelength:"*string(length(sInfo))) send popup_modal to (debug_panel(self)) indicate Found As giDebugOldFound indicate FindErr As giDebugOldFindErr Move giDebugOldLastErr To LastErr end_procedure