Input on one dialog to display on different dialog

Input on one dialog to display on different dialog

Postby reinaldocrespo » Thu Mar 16, 2006 9:37 pm

Hi.

Me again asking for help.

I need to allow input into gets from another dialog that simply displays the numeric keypad. Here is that image:
[/img]
http://www.structuredsystems.com/pictur ... screen.jpg
[/img]
Here is my code:
Code: Select all  Expand view  RUN
... in ::odlg definition (main dialog)
   REDEFINE GET aGet[ 3] VAR ::oTrg:VarBP ID 103 OF ::ofld:aDialogs[ 1 ] Picture "999/999" VALID( ColorIfEmpty( aget[ 3 ] ) )
   aget[ 3 ]:bGotFocus := {|| ::oActive := aGet[ 3 ] }
...
... now inside NumKeyPad Dlg definition
local oSelf      := Self
      DEFINE DIALOG oSelf:oKeyPadDlg RESOURCE "NUM_KEYPAD" OF oSelf:oDlg BRUSH oBrush
...
      REDEFINE BTNBMP oBtn[12] ID 112 RESOURCE "NUM_RIGHT" OF oSelf:oKeyPadDlg ACTION oSelf:Insert( VK_RIGHT ) NOBORDER
      REDEFINE BTNBMP oBtn[13] ID 113 RESOURCE "NUM_ENTER" OF oSelf:oKeyPadDlg ACTION oSelf:Insert( VK_TAB ) NOBORDER
      aEval( obtn, { |e|e:lTransparent := .t. } )
      ACTIVATE DIALOG oSelf:oKeyPadDlg NOWAIT ON INIT oSelf:oDlg:SetFocus()
...
*-------------------------------------------------------------------------------------------------------------------------------
METHOD Insert( xKey ) CLASS TTriage
Local nFocus   := ::oDlg:oCtlFocus:nOption

   if nFocus == 1 .and. ValType( ::oActive ) <> "U"
      ::odlg:SetFocus()
      FwKeyboard( ::oActive, xKey ) //thanks J.Bott
   Endif

RETURN NIL

It almost works.

The problem is in method Insert. By setting focus to ::odlg (main dialog), the cursor goes to the very first get on the dialog. If not setting focus to ::odlg, then nothing gets inputed into the gets.

Help please?

Reinaldo.[/url]
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Postby James Bott » Thu Mar 16, 2006 9:59 pm

Reinaldo,

I think we are going to need a small self-contained example.

Also I do not understand why you are using a local oSelf:

local oSelf := Self
DEFINE DIALOG oSelf:oKeyPadDlg RESOURCE "NUM_KEYPAD" OF oSelf:oDlg BRUSH oBrush

oSelf:oKeyPadDlg is the same as ::oKeyPadDlg. You don't need a local. Perhaps you are confused about this?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby reinaldocrespo » Thu Mar 16, 2006 11:27 pm

James;

Thank you for answering. Good question on the oself. I have discovered that:

Code: Select all  Expand view  RUN
      ACTIVATE DIALOG ::oKeyPadDlg NOWAIT ON INIT ::oDlg:SetFocus()


Will cause an error at run time. ::oDlg is presumed to belong to the tdialog class at runtime. So I get around that problem by referencing as oself:oDlg.
Application
===========
Path and name: F:\mp\triage.exe (32 bits)
Size: 2,423,808 bytes
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 03/16/2006, 18:20:09
Error description: Error BASE/1004 Message not found: TDIALOG:ODLG


It will cause the same runtime error here:
Code: Select all  Expand view  RUN
      REDEFINE BTNBMP oBtn[13] ID 113 RESOURCE "NUM_ENTER" OF ::oKeyPadDlg ACTION ::Insert( VK_TAB ) NOBORDER


Application
===========
Path and name: F:\mp\triage.exe (32 bits)
Size: 2,423,808 bytes
Time from start: 0 hours 0 mins 11 secs
Error occurred at: 03/16/2006, 18:23:15
Error description: Error BASE/1004 Message not found: TBTNBMP:INSERT

So I get around that problem with oself:Insert( VK_TAB ). Pretty soon I'm using oSelf anywhere I'm defining or redefining just to make sure that the pre-processor does not make the wrong association.

I will try to build a self-contained example. But if you look at the picture, you pretty much get an idea of what I'm trying to do.



Reinaldo
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Postby James Bott » Fri Mar 17, 2006 2:35 am

Reinaldo,

>Will cause an error at run time. ::oDlg is presumed to belong to the tdialog class at runtime. <

Ah, yes. That is because the preprocessor passes self in the codeblock. I think you can get around that problem by defining the codeblock yourself.

> I will try to build a self-contained example. But if you look at the picture, you pretty much get an idea of what I'm trying to do.<

Oh, I see what you are trying to do, but I can't run your code example to test it.

James[/u]
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby reinaldocrespo » Fri Mar 17, 2006 4:11 am

James;

I'm sure you are dieing to ask, so let me be quite frank. I'm aware that this type of input interface is not as efficient as doing the input via the keyboard. Originally I was reluctant to implement a visual keypad for data entry. But was later persuaded by the customer for two reasons (besides the fact that the customer is always right):

1. The operator will be using a touch screen to do the input. That changes the panorama.

2. The people that make purchasing decisions are strongly influenced by touch screen graphical input screens. They don't understand that some times less is more.

I have tried to simplify the code as much as possible and have uploaded a sample .prg + .rc zipped into triage.zip and is available from
[URL]
www.structuredsystems.com/pictures/screenpicture/
[/URL]
It is "compilable" with fw's buildx.bat.

You'll notice that it works well except for numeric and date variable types. Haven't figure out why.


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Postby James Bott » Fri Mar 17, 2006 7:01 am

Reinaldo,

I have downloaded your sample and have it running, but its late and I have to drive all day tomorrow, so I will look at when I return.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Fri Mar 17, 2006 8:06 am

reinaldocrespo wrote:You'll notice that it works well except for numeric and date variable types. Haven't figure out why.


Because numeric and date restores to the first position on gotfocus.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby reinaldocrespo » Fri Mar 17, 2006 11:49 am

Enrico;

Hi.

Thank you for the reply.

Yes, I did notice that once the get control gets focus it does restore to the first position. Perhaps there is a work-around to this?

Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 37 guests

cron