Page 1 of 1

Using navigation keys in dcbrowse without first clicking in

Posted: Fri Apr 25, 2014 9:30 am
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.

Re: Using navigation keys in dcbrowse without first clicking

Posted: Fri Apr 25, 2014 12:14 pm
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()}

Re: Using navigation keys in dcbrowse without first clicking

Posted: Sat Apr 26, 2014 7:10 am
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.

Re: Using navigation keys in dcbrowse without first clicking

Posted: Fri Jan 23, 2015 10:09 am
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()}
...

Re: Using navigation keys in dcbrowse without first clicking

Posted: Fri Jan 23, 2015 11:09 am
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.

Re: Using navigation keys in dcbrowse without first clicking

Posted: Fri Jan 23, 2015 11:43 am
by obelix
Thank you for looking to my problem. Tomorrow I'll upload a testprogram showing this problem.

Re: Using navigation keys in dcbrowse without first clicking

Posted: Fri Jan 23, 2015 12:36 pm
by obelix
test.zip
I added collect.dbt
(385.78 KiB) Downloaded 863 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

Re: Using navigation keys in dcbrowse without first clicking

Posted: Sat Jan 24, 2015 5:46 am
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

Re: Using navigation keys in dcbrowse without first clicking

Posted: Sat Jan 24, 2015 7:28 am
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