xBrowse as Excel behaviour

xBrowse as Excel behaviour

Postby ukservice » Fri Jan 14, 2011 9:23 am

Mr. Rao,

How can xBrowse works as Excel behaviour, for example, when you press Enter a new line is created, etc?.

Thank you
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: xBrowse as Excel behaviour

Postby James Bott » Fri Jan 14, 2011 5:49 pm

UKService,

This code works with TWBrowse, but I haven't tried it with TXBrowse:

oLbx:bKeydown := {|nKey,nFlags| ;
IIF(nKey == VK_RETURN, ::edit(),)}

You would have to add a record to the DBF, then refresh the browse. Replace ::edit() with your own function.

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

Re: xBrowse as Excel behaviour

Postby nageswaragunupudi » Sat Jan 15, 2011 3:05 am

By default, XBrowse mostly behaves like Excel when columns are Editable and FastEdit is enabled.

Pressing any key enters edit mode with that key as the first key and if edit is exited with up or down arrow the cursor moves to the cell above or below the current cell like Excel.

If only some columns are editable, the behavior is identical to Excel where some cells are protected. Cursor jumps to the next editable cell in both cases. Editable cell is the cell where oCol:nEditType > 0 and oCol:bEvalWhen is nil or evaluates to .t..

One difference betwen Excel and Xbrowse is that in Excel, pressing Enter key does not invoke edit but moves the cursor to the next column, whereas in XBrowse, by default, Enter key enters edit. F2 key invokes edit in Excel, where as this key is ignored in XBrowse.

Even in this case, XBrowse can be set to mimic fully Excel behavior by setting
Code: Select all  Expand view

oBrw:lEnterKey2Edit := .f.  // ( default .t. )
oBrw:lF2KeyToEdit   := .t.  // ( default .f. )
 

With these settings, XBrowse behaves fully like Excel.

There is another feature in Excel. We can enter "=400*20" to get 8000. By default this is not possible with XBrowse.
But by setting
Code: Select all  Expand view
oBrw:lFormulaEdit := .t. // (default .f. )

we can enter formulae in XBrowse cells too, like we do in Excel. One difference between Excel and XBrowse is that Excel remembers the fomula forever but XBrowse evaluates the expression and stores the result, discarding the formula. Still this feature is very useful to the users who can enter simple calculations directly into the cells, instead of using calculator before entering into the cells.

For automatically creating new rows, oBrw:bPastEof may be assigned with appropriate codeblock to instruct xbrowse what to do when the user is navigating past the eof. There are some samples in the samples folder explaining the usage.

XBrowse is feature rich, but many of the features are not available to those who still use the very old way of programming like using oCol:bStrData.... ,etc.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 86 guests

cron