BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-14-2005, 09:16 AM   #1
smheoc
Knows Where the Search Button Is
 
Join Date: Jan 2005
Posts: 20
Default Best Way to Implement a Debug Screen

Please Login to Remove!

Hello,
I have developed a few apps that work together. I have also created an OptionsProvider, under which I want the option to display a "debug" screen. This debug screen should contain messages sent by any of the other applications in my suite.
My first attempt at this did work (using a RunTime object (string) which I appended to every time). The problem is that when I run it the first time everything is good, but if I exit the debug screen then I can never access it again because I get an Exception.

Is there a bettery way to create such a debug screen?
Offline  
Old 04-15-2005, 06:52 AM   #2
arconsulting
Thumbs Must Hurt
 
Join Date: Aug 2004
Location: Metro NYC
Posts: 175
Default

I create debug screens that require a certain series of keystrokes to display. Similar to the display of RIM's log screen (ALT-L-G-L-G).

In my KeyListener, I check for ALT plus the keys and display my screen.
__________________
-- Aric Rosenbaum
BlackBerry consulting, BlackBerry development
www.arconsultinginc.com
BlackBerry consulting and development (RIM SI Partner)
Offline  
Old 04-15-2005, 10:22 AM   #3
smheoc
Knows Where the Search Button Is
 
Join Date: Jan 2005
Posts: 20
Default

I have toyed with that idea, but it isn't really required for my application. In any event, the problem wasn't so much "how to access the screen", but rather, how to pass data from other applications.

Right now I am using a RuntimeStore object (a string) which I append to. The problem is that when I show the screen it does not get updated in realtime.

eg:
Other applications write to the debug screen by calling:
Code:
DebugScreen.DebugMessage("This is my message");
The OptionsProvider creates the screen when required, and the constructor creates a RichTextField.

Code:
class DebugScreen /*...*/{
   private static RichTextField _output;
   /* ... */
   public DebugScreen(){
      /* ... */
      String strCurrOutput = /* Get from runtime store */
      _output = new RichTextField("Started...\n" + strCurrOutput);
   }

   /* ... */
   public void DebugMessage(String msg){
      /* add msg to runtimestore object */
      if(_output != null){
        _output.setText( textfromruntimestore );
      }
   }
}
When I first open the debug screen, I get all debug messages that were present in the runtime store (no problem there). The problem is that while the window is open, it never gets updated!

Last edited by smheoc; 04-15-2005 at 10:25 AM..
Offline  
Old 04-15-2005, 10:52 AM   #4
smheoc
Knows Where the Search Button Is
 
Join Date: Jan 2005
Posts: 20
Default

I have a working solution now, however I welcome recommendations...

I have created two RuntimeStore objects, one String to contain all the messages, and one RichTextField to indicate if the window is visible.

1) In the constructor for the display, I create the RTF object and populate it with the String contents.

2) In the onClose() function I remove the RTF from the RuntimeStore.

3) In the the DebugMessage function, I add the message to the String, and if the RTF object exists, then the window is created, so I add the new string to it. Otherwise, the debug window is not open so I don't need to worry.

I realize that this is pretty shabby coding, but it works. Any suggestions for improvement?
Offline  
Old 04-15-2005, 12:57 PM   #5
jbartel
Knows Where the Search Button Is
 
Join Date: Sep 2004
Posts: 17
Default

Is there a reason why you don't want to use the system log?
Offline  
Old 04-15-2005, 01:47 PM   #6
smheoc
Knows Where the Search Button Is
 
Join Date: Jan 2005
Posts: 20
Default

I suppose there isn't really a "good" reason why I don't just use the system log. However I want to provide the users with a "one-stop-shopping" location to go for the troubleshooting messages. Rather than have to tell them all "Hit Alt-LGLG and tell me what you see", I can have them access my debug menu from my options menu.

This is more intuitive to the user and I have more control over what they are seeing.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Schneider PLC TWIDO TM2AMM6HT ANALOGUE I/O MODULE 20mA 24VDC Missing Terminal picture

Schneider PLC TWIDO TM2AMM6HT ANALOGUE I/O MODULE 20mA 24VDC Missing Terminal

$156.00



HealthKit 4802 Computer Oscilloscope Heath Computer Systems picture

HealthKit 4802 Computer Oscilloscope Heath Computer Systems

$120.00



Electronic Development Company Programmable IEEE 488 GP-1B D.C Calibrator EDC521 picture

Electronic Development Company Programmable IEEE 488 GP-1B D.C Calibrator EDC521

$1200.00



SCHNEIDER Twido TW2AMI2HT Analog 2 in 0-10v, 4-20ma Module PLC Modicon picture

SCHNEIDER Twido TW2AMI2HT Analog 2 in 0-10v, 4-20ma Module PLC Modicon

$119.99



SCHNEIDER Twido TWDAMM6HT Analog I/O Module PLC Modicon picture

SCHNEIDER Twido TWDAMM6HT Analog I/O Module PLC Modicon

$119.99



NEW NO BOX- Analog Devices AIM03 Computer Module || Fast Shipped🇺🇸Warranty picture

NEW NO BOX- Analog Devices AIM03 Computer Module || Fast Shipped🇺🇸Warranty

$150.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.