celleditor

This forum is for eXpress++ general support.
Post Reply
Message
Author
zolifree
Posts: 35
Joined: Sun Sep 19, 2010 6:55 am

celleditor

#1 Post by zolifree »

Hi Roger,

In DCBROWSE I use this:

EDIT xbeBRW_ItemSelected ;
MODE DCGUI_BROWSE_EDITEXIT ;

but the user can press the Up or Down keys, and the editor moves to the line according to the arrow. But I do not want this. I want the celledit finish when the user hit the Up or Down arrow like the with ENTER key.
I have very complex BROWSES, and I do not know why, but 2-3 Up or Down keypress in celledit freeze. The cursor blinking in the edit field, but there is no keyboard input processed. No letters no arrows, no ENTER. Nothing works, until the user click to another cell with the mouse. After that it works again until the next 2-3 Up or Down arrow keypress in cellediting.
I can replicate it 100/100 in my program, but I cannot in a separate small testprogram.
Because of it,I only want to be able to exit from celleditor with the Up or Down arrow.
The other reason is, if I editing an indexed column, the position of the row is moving after celledit, and in this case the Up/Down key not good if stays in celledit.

Best regards,
Zoltan

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: celleditor

#2 Post by rdonnay »

Zoltan -

I suggest that you use the HANDLER clause. This will allow you to intercept keystrokes.

If you still do not get the behavior you want, then I suggest that your look at the .\samples\celledit\celledit.prg sample program.
This is how you would handle cell editing externally from the DCBROWSE command EDIT technique.

Roger
The eXpress train is coming - and it has more cars.

zolifree
Posts: 35
Joined: Sun Sep 19, 2010 6:55 am

Re: celleditor

#3 Post by zolifree »

Roger,

not working, I tried everithyng.
No event appears in HANDLERBLOCK during cellediting.
I tried the kexblock, but no event apperas there too for up/down arrow keys.
Can You create a new mode for DCBROWSE similar to
MODE DCGUI_BROWSE_EDITEXIT ?
And that is quit the cellediting with the up/down arrow?
I did not find any reference to DCGUI_BROWSE_EDITEXIT in the source code, except DCDIALOG.CH.

Zoltan

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: celleditor

#4 Post by rdonnay »

Here is a sample that works:

Code: Select all

#INCLUDE "dcdialog.ch"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], oBrowse, aDir, i

aDir := Directory()

@ 0,0 DCBROWSE oBrowse DATA aDir SIZE 100,20 ;
      EDIT xbeBRW_ItemSelected ;
         HANDLER myHandler

FOR i := 1 TO 10
  DCBROWSECOL ELEMENT i HEADER Alltrim(Str(i)) WIDTH 10 PARENT oBrowse
NEXT

DCREAD GUI FIT TITLE 'Cell Editing'

RETURN nil

* ----------

PROC appsys ; RETURN

* ----------

STATIC FUNCTION myHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )

IF nEvent == xbeP_Keyboard .AND. ( mp1 == xbeK_DOWN .OR. mp1 == xbeK_UP )
  RETURN DCGUI_EXIT_OK
ENDIF

RETURN DCGUI_NONE
The eXpress train is coming - and it has more cars.

zolifree
Posts: 35
Joined: Sun Sep 19, 2010 6:55 am

Re: celleditor

#5 Post by zolifree »

This sample works, but in my program not.
The window closes as soon as pressing the up or down arrow.
I do not know why behave so differently with the same HANDLER block.
A use DCBROWSE on DBF files with many columns, many celleditors, buttons, hotkeys, and HANDLER block.
I have valids, pictures in the celleditors, maybe that is the cause.
And I use the DCBROWSE ACTION and EXIT codeblocks too.
I have to test what makes it wrong or right.
If I change the data in the celleditor, then it exits when I press the down arrow.
But when I not change the data, that is when stay in get mode on the next record after pressing the down arrow.

Zoltan

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: celleditor

#6 Post by rdonnay »

It is not easy to get the exact behavior that you want when cell editing.

This is why I wrote the celledit sample for another eXpress++ user so he could program it exactly as he wanted.
The eXpress train is coming - and it has more cars.

Post Reply