Text-based user interface in FWPPC

Text-based user interface in FWPPC

Postby toddevans » Mon Aug 30, 2010 12:52 pm

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
toddevans
 
Posts: 6
Joined: Wed Feb 04, 2009 9:33 pm
Location: US

Re: Text-based user interface in FWPPC

Postby Antonio Linares » Mon Aug 30, 2010 10:29 pm

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  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42097
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Text-based user interface in FWPPC

Postby toddevans » Tue Aug 31, 2010 11:04 pm

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
toddevans
 
Posts: 6
Joined: Wed Feb 04, 2009 9:33 pm
Location: US


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 6 guests