Text-based user interface in FWPPC

Post Reply
toddevans
Posts: 6
Joined: Wed Feb 04, 2009 9:33 pm
Location: US
Contact:

Text-based user interface in FWPPC

Post by toddevans »

Is it possible to simulate a console-like text-based user interface using FWPPC? Say creating a window then using @SAY/GETs, CLEARSCREEN, etc.?

Surprisingly, we still have customer using our MS-DOS based terminals (Falcon 3XX, TopGun, PT2000) running text-based applications. Slowly they are migrating to our Windows Mobile and CE products.

To make that transition easier (and to preserve documentation and existing processes) we'd prefer to duplicate that text-based experience when porting their apps to our newer hardware. Then once on the new platform we can rework the user-interface in a Windows model.

Over the weekend I experimented with creating a window and displaying text with SAY commands. I discovered that I couldn't overwrite previously SAY'd text with subsequent SAYs at the same row and column. Reviewing the .PPO I found that each SAY is a new object.

After more experimenting I found that if I specified the SAY text as a variable, added the UPDATE clause, and called Twindow:Update() then the SAY text would be updated in the window.

Is this the right approach? Any tips/guidelines for creating text-based like apps in FWPPC?

Thanks,

Todd Evans
-------------
Datalogic Mobile
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Text-based user interface in FWPPC

Post by Antonio Linares »

Todd,

As far as we know Windows Mobile, neither Windows CE, provide console windows so we have to emulate them.

This is a FWH example that could be easily adapted to FWPPC:

Code: Select all

#include "FiveWin.ch"

static oWnd, buffer[ 25, 80 ]

function Main()

   local oFont, nRow, nCol

   for nRow = 1 to 25
      for nCol = 1 to 80
          buffer[ nRow, nCol ] = " "
      next
   next       

   DEFINE FONT oFont NAME "Courier New" SIZE 0, -12

   DEFINE WINDOW oWnd TITLE "Terminal" COLOR "W+/B"
   
   oWnd:SetFont( oFont )

   Say( 5, 5, "Hello world!" )
   
   Say( 10, 12, "A terminal emulator" )

   ACTIVATE WINDOW oWnd ;
      ON PAINT DumpText( oWnd )   

return nil

function DumpText( oWnd )

   local nRow, nCol
   
   for nRow = 1 to 25
      for nCol = 1 to 80
         oWnd:Say( nRow, nCol, buffer[ nRow, nCol ] )
      next
   next
   
return nil   

function Say( nRow, nCol, cText )

   local n
   
   for n = 1 to Len( cText )
      buffer[ nRow, nCol + n - 1 ] = SubStr( cText, n, 1 )
   next
   
   oWnd:Refresh()
   
return nil   
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
toddevans
Posts: 6
Joined: Wed Feb 04, 2009 9:33 pm
Location: US
Contact:

Re: Text-based user interface in FWPPC

Post by toddevans »

Hi Antonio,

Thanks for the quick reply! This screen buffer technique you show is similar to what I've done before in C on another project where I needed to simulate a text type interface on a PocketPC. So this is how its done with FWPPC too.

Windows CE has a built-in console (at least our hardware does) and for Windows Mobile you can install the PPC Command Shell from the Windows Mobile Developer Toys collection separately if you like.

http://www.microsoft.com/downloads/deta ... laylang=en

I certainly wouldn't spend anytime making FWPPC integrate with the console. :) Mainly we use the CMD.EXE and the console for executing install scripts and simple debugging.

Here's what the console looks like in CE on our Falcon line:

Image

And here's the PPC command shell running on a Memor over Windows Mobile 6.1

Image

The key for getting console output on Windows Mobile is this registry key should be set to 0. By default, it's all F's.

[HKEY_LOCAL_MACHINE\Drivers\Console]
"OutputTo"=dword:0

Best, -Todd
Post Reply