Using navigation keys in dcbrowse without first clicking in

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Using navigation keys in dcbrowse without first clicking in

#1 Post by obelix »

Hi everybody,

Before navigating in the DCBROWSE-window with UP DOWN LEFT RIGHT PGDN PGUP- Key , I have to click into the window.
How can I do this without first setting the focus to the browse-window.

extract of my code

@ 3,2 DCBROWSE oVBrowse; //PARENT oTabPage1 ;
DATA cAlias SIZE wcol,wrow FONT feldfont
DCBROWSECOL FIELD &felder1 WIDTH 10 ;
HEADER feldub1 PARENT oVBrowse
DCBROWSECOL FIELD &felder1 WIDTH 10 ;
HEADER feldub1 PARENT oVBrowse
.....

i=df
@ wrow+vv+1, 1+hv DCPUSHBUTTON CAPTION "F1 Hilfe" SIZE 12+i,1 FONT textfont1 ACTION {||dummy()}
@ wrow+vv , 16+hv+i*1 DCSAY "Sortierung" SAYFONT textfont1
@ wrow+vv+1, 16+hv+i*1 DCPUSHBUTTON CAPTION "F2 Schlssel" SIZE 12+i,1 FONT textfont1 ACTION
{||w_order(1),oVBrowse:RefreshAll()}
....

ctitle=titelzeile
DCREAD GUI FIT TO lStatus ;
TITLE cTitle OPTIONS GetOptions HANDLER myhandlerEPfu ENTEREXIT // FIT ADDBUTTONS
RETURN lStatus



Thank you for your help.
quiet old but still young and unskilled in express++

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

Re: Using navigation keys in dcbrowse without first clicking

#2 Post by rdonnay »

You would have to use the navigation methods of the XbpBrowse() class.

Code: Select all

@ .. dcpushbutton caption 'Up' action {||oBrowse:up(),oBrowse:forceStable()}
@ .. dcpushbutton caption 'Down' action {||oBrowse:down(),oBrowse:forceStable()}
@ .. dcpushbutton caption 'Left' action {||oBrowse:left(),oBrowse:forceStable()}
@ .. dcpushbutton caption 'Right' action {||oBrowse:right(),oBrowse:forceStable()}
The eXpress train is coming - and it has more cars.

User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Re: Using navigation keys in dcbrowse without first clicking

#3 Post by obelix »

thank you, Roger
for your quick an fitting advice. I combine it with your earlier advice:
DCHOTKEY xbeK_UP ACTION .....
and so I can offer to the user the complete navigation system used by keys or mouse.
quiet old but still young and unskilled in express++

User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Re: Using navigation keys in dcbrowse without first clicking

#4 Post by obelix »

Hi Roger,

for this problem you gave me a good advice. But I used DCHOTKEY xbeK_UP ACTION {||oBrowse:down(),oBrowse:forceStable()}
instead of dcpushbutton caption 'Down' action {||oBrowse:down(),oBrowse:forceStable()} which works really good,
but since I use DCBROWSE .... EDIT xbeBRW_ItemSelected for editing a cell by doubleclick, which works right too,
I have the problem, that using a navigation key after having edited a cell by doubleclick, the cursor jumps two cells instead of one, definitively triggered by the DCHOTKEY xbeK_up etc.
which ist not really pleasant.
Is there a chance to avoid this?

Code: Select all

 calias1=alias()
@ 3,2 DCBROWSE oBrowse  DATA calias1  SIZE wcol,wrow FONT textfont ;
   [b]EDIT xbeBRW_ItemSelected[/b] MODE DCGUI_BROWSE_EDITEXIT ;
   PRESENTATION DC_BrowPres()

 DCBROWSECOL  FIELD &calias1->m WIDTH 1;
   HEADER feldub1 PARENT oBrowse
 DCBROWSECOL FIELD  &calias1->apos WIDTH 6;
   HEADER feldub2 PARENT oBrowse

... several DCBROWSCOLs...

... severals DCHOTKEYs...


DCHOTKEY xbeK_UP    ACTION {||oBrowse:up(),oBrowse:forceStable()} //65574
DCHOTKEY xbeK_DOWN  ACTION {||oBrowse:down(),oBrowse:forceStable()} //65576
DCHOTKEY xbeK_LEFT  ACTION {||oBrowse:left(),oBrowse:forceStable()} //65573
DCHOTKEY xbeK_RIGHT ACTION {||oBrowse:right(),oBrowse:forceStable()} //65575
DCHOTKEY xbeK_PGUP  ACTION {||oBrowse:pageup(),oBrowse:forceStable()} //65569
DCHOTKEY xbeK_PGDN  ACTION {||oBrowse:pagedown(),oBrowse:forceStable()} //65570
DCHOTKEY xbeK_HOME  ACTION {||oBrowse:gotop(),oBrowse:forceStable()} //65572
DCHOTKEY xbeK_END   ACTION {||oBrowse:gobottom(),oBrowse:forceStable()} //65571
DCREAD GUI FIT TO lStatus;
TITLE titelzeile  ENTEREXIT HANDLER MyHandlerV  OPTIONS GetOptions REFERENCE @oBrowse FIT; //
EVAL {||oBrowse:hide(), oBrowse:show()} // ,obrowse:refreshall()}
...
quiet old but still young and unskilled in express++

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

Re: Using navigation keys in dcbrowse without first clicking

#5 Post by rdonnay »

I have the problem, that using a navigation key after having edited a cell by doubleclick, the cursor jumps two cells instead of one, definitively triggered by the DCHOTKEY xbeK_up etc.
which ist not really pleasant.
Is there a chance to avoid this?
I don't know why this would be happening.
I will need to write a test program to figure it out.

You could help me out by writing one for me.
I'm a bit busy today.
The eXpress train is coming - and it has more cars.

User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Re: Using navigation keys in dcbrowse without first clicking

#6 Post by obelix »

Thank you for looking to my problem. Tomorrow I'll upload a testprogram showing this problem.
quiet old but still young and unskilled in express++

User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Re: Using navigation keys in dcbrowse without first clicking

#7 Post by obelix »

test.zip
I added collect.dbt
(385.78 KiB) Downloaded 862 times
Roger,
I modified your FUNCTION XSample_10 in XDEMO and added the DCHOTKEY lines enabling the navigation in the table without first clicking in.
I disabled the HOTKEY xbeK_UP to show you the difference between navigation up and down . I added the database collect.dbf and collect.ntx
for other users who want to simulate the bug.
Thank you for trying to find a solution.

Peter

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.ch"
proc main()

LOCAL GetList := {}, oBrowse, oBrowBox, oMsgBox, aType, xNIL

USE COLLECT VIA DBFNTX NEW SHARED

@ .1,.5 DCBROWSE oBrowse PARENT oBrowBox ALIAS 'COLLECT' ;
   SIZE 77,11.8 ;
   EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITACROSSDOWN ;
   DELETE xbeK_DEL ;
   INSERT xbeK_INS ;
   PRESENTATION DC_BrowPres()

DCBROWSECOL FIELD COLLECT->descrip ;
  WIDTH 8 ;
  HEADER "Description" PARENT oBrowse 

DCBROWSECOL FIELD COLLECT->type ;
  WIDTH 6 ;
  HEADER "Type" PARENT oBrowse 

DCBROWSECOL FIELD COLLECT->date_orig ;
  HEADER "Orig Date" PARENT oBrowse ;
  WIDTH 6 


DCBROWSECOL FIELD COLLECT->date_acqu ;
  HEADER "Acqu Date" PARENT oBrowse ;
  WIDTH 6 


@ 10,2    DCPUSHBUTTON CAPTION 'OK'           SIZE 12,1 ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@ 10,14   DCPUSHBUTTON CAPTION 'Abbruch'     SIZE 12,1 ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList)}

//DCHOTKEY xbeK_UP    ACTION {||oBrowse:up(),oBrowse:forceStable()} //65574
DCHOTKEY xbeK_DOWN  ACTION {||oBrowse:down(),oBrowse:forceStable()} //65576
DCHOTKEY xbeK_LEFT  ACTION {||oBrowse:left(),oBrowse:forceStable()} //65573
DCHOTKEY xbeK_RIGHT ACTION {||oBrowse:right(),oBrowse:forceStable()} //65575
DCHOTKEY xbeK_PGUP  ACTION {||oBrowse:pageup(),oBrowse:forceStable()} //65569
DCHOTKEY xbeK_PGDN  ACTION {||oBrowse:pagedown(),oBrowse:forceStable()} //65570
DCHOTKEY xbeK_HOME  ACTION {||oBrowse:gotop(),oBrowse:forceStable()} //65572
DCHOTKEY xbeK_END   ACTION {||oBrowse:gobottom(),oBrowse:forceStable()} //65571

DCREAD GUI ;
   FIT ;
   MODAL ;
   BUTTONS DCGUI_BUTTON_EXIT ;
   TITLE 'Example of Browse Cell-Editing (double-click on a cell)'
use
return
Last edited by obelix on Sat Jan 24, 2015 7:25 am, edited 1 time in total.
quiet old but still young and unskilled in express++

messaoudlazhar
Posts: 42
Joined: Mon Dec 23, 2013 2:10 pm
Contact:

Re: Using navigation keys in dcbrowse without first clicking

#8 Post by messaoudlazhar »

hi obelix

- the data file (DBF File) contains a memo field and the DBT File is absent, copy the DBT file to test directory.
- Try to ignore the control the HOTKEY
.
.
/*
//DCHOTKEY xbeK_UP ACTION {||oBrowse:up(),oBrowse:forceStable()} //65574
DCHOTKEY xbeK_DOWN ACTION {||oBrowse:down(),oBrowse:forceStable()} //65576
DCHOTKEY xbeK_LEFT ACTION {||oBrowse:left(),oBrowse:forceStable()} //65573
DCHOTKEY xbeK_RIGHT ACTION {||oBrowse:right(),oBrowse:forceStable()} //65575
DCHOTKEY xbeK_PGUP ACTION {||oBrowse:pageup(),oBrowse:forceStable()} //65569
DCHOTKEY xbeK_PGDN ACTION {||oBrowse:pagedown(),oBrowse:forceStable()} //65570
DCHOTKEY xbeK_HOME ACTION {||oBrowse:gotop(),oBrowse:forceStable()} //65572
DCHOTKEY xbeK_END ACTION {||oBrowse:gobottom(),oBrowse:forceStable()} //65571
*/

- Add the line :
DCREAD GUI ;
FIT ;
MODAL ;
BUTTONS DCGUI_BUTTON_EXIT ;
TITLE 'Example of Browse Cell-Editing (double-click on a cell)';
EVAL {|o| o:resize:= {|a,b,o|DC_AUTORESIZE(a,b,o,GetList),o:hide(),o:show()},;
SetAppFocus(@oBrowse), oBrowse:RefreshAll(), DC_GetRefresh(GetList)}


Messaoud Mohamed Lazhar

User avatar
obelix
Posts: 48
Joined: Tue Dec 03, 2013 7:44 am
Location: Villingen-Schwenningen, Black Forest, Germany

Re: Using navigation keys in dcbrowse without first clicking

#9 Post by obelix »

Thank you Messoud for your posting, I'll try your proposal soon,
I added collect.dbt to my attachement

Oh I tried it and it really works :violin: :violin: :violin:
It seems to be the solution. I just needed an impulse to my app to navigate in the browsed table.
thank you for your help.

Peter
quiet old but still young and unskilled in express++

Post Reply