How to programmatically click on a cell of an xBrowse?

How to programmatically click on a cell of an xBrowse?

Postby hua » Wed Mar 23, 2011 5:06 am

How to programmatically click on a cell of an xBrowse?

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to programmatically click on a cell of an xBrowse?

Postby nageswaragunupudi » Wed Mar 23, 2011 6:29 am

oBrw:SetPos( nRow, nCol )

nRow is the visible row number from top and nCol is the visible column from left.
Regards

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

Re: How to programmatically click on a cell of an xBrowse?

Postby hua » Wed Mar 23, 2011 7:04 am

Thanks Rao. How to obtain the initial relative nRow and nCol?

Thanks again.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to programmatically click on a cell of an xBrowse?

Postby hua » Wed Mar 23, 2011 8:12 am

Hi again Rao,

I'm trying to prevent user from being able to enter amount under Debit and Credit column if the account code is empty.

This is how I code it
Code: Select all  Expand view

     :bEditWhen  := {|oCol| CanEnterAmt(oCol) }
         .
         .
function CanEnterAmt(oCol)
  local lRet := .t., nRow, nCol
  if empty(oApp:oBrw:aArrayData[ oApp:oBrw:nArrayAt, LN_ACCN ])
     lRet := .f.
     // reset debit/credit amt col just in case
     oApp:oBrw:aArrayData[ oApp:oBrw:nArrayAt, LN_AMOU_DR ] := 0.00
     oApp:oBrw:aArrayData[ oApp:oBrw:nArrayAt, LN_AMOU_CR ] := 0.00
     oApp:oBrw:drawSelect()

     nRow := oApp:oBrw:nRowSel
     nCol := oApp:oBrw:nColSel
     msgalert("Amount can't be entered unless account code is specified")

     oApp:oBrw:setPos(nRow, nCol)
     oApp:oBrw:setFocus()
  endif
return lRet
 


So during testing I:
i. clicked on the cell under Debit
ii. pressed Enter and got a message that I'm not allowed to enter anything which is what's expected.
iii. pressed Enter again to close the message box. First problem, the previous cell in focus not reselected though oBrw:setPos() was called.
iv. pressed Enter again, expecting to get the message box again but instead I got the messsage "oCol:aEditListTxt not defined" which I don't know where it came from.

I did a screen cast to show what I mean and you can view it at http://www.screencast.com/t/h6X0rlLo

Any ideas are welcomed.

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to programmatically click on a cell of an xBrowse?

Postby nageswaragunupudi » Wed Mar 23, 2011 1:24 pm

bEditValid of a column in XBrowse may not contain any screen I/O like MsgInfo(), etc. This could result in unexpected behavior. We may have to accept this as a limitation.
Regards

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

Re: How to programmatically click on a cell of an xBrowse?

Postby Gale FORd » Wed Mar 23, 2011 1:34 pm

That seems to be quite a limitation. I was going to use xBrowse for some data entry, but this might be an issue.
What would be your suggestion for informing the user what the entry error was?
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: How to programmatically click on a cell of an xBrowse?

Postby James Bott » Wed Mar 23, 2011 2:11 pm

Maybe you could gray-out the cells until the account code is entered.

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

Re: How to programmatically click on a cell of an xBrowse?

Postby hua » Thu Mar 24, 2011 1:50 am

Rao wrote:bEditValid of a column in XBrowse may not contain any screen I/O like MsgInfo(), etc.


I guess this applies to bEditWhen too?. I kinda agree with Gale it seems like a serious limitation. Hope Antonio could come up with some solution.

Thanks for the idea James. That's better than leaving a bewildered user pounding on the keyboard till it breaks not knowing what's wrong. :)
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to programmatically click on a cell of an xBrowse?

Postby James Bott » Thu Mar 24, 2011 4:35 am

Here is another idea. Color the account code field pink until valid data has been entered, then turn white or green. Then un-gray the other fields, and if they are required then turn them pink until valid.

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

Re: How to programmatically click on a cell of an xBrowse?

Postby Gale FORd » Thu Mar 24, 2011 6:36 am

I don't think the user would know why it is invalid. I use valid routines all the time that take partially entered data and look it up in a database and present a list of choices. For instance a customer code. I don't think the user should have to know all of the 10 characters necessary to look up the customer code.

I would love to have a control that works like the Google toolbar field. Once you start typing it drops down a list and narrows the options the more you type the closer the match.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: How to programmatically click on a cell of an xBrowse?

Postby hua » Thu Mar 24, 2011 6:52 am

James Bott wrote:Here is another idea. Color the account code field pink until valid data has been entered, then turn white or green. Then un-gray the other fields, and if they are required then turn them pink until valid.


* sigh * When I was about to change the code I just realized this option is not viable for me as not all line must have an account code because users are allowed to key-in any additional remarks that they want. Well, back to the drawing board.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to programmatically click on a cell of an xBrowse?

Postby James Bott » Thu Mar 24, 2011 2:06 pm

Gale,

I don't think the user would know why it is invalid. I use valid routines all the time that take partially entered data and look it up in a database and present a list of choices. For instance a customer code. I don't think the user should have to know all of the 10 characters necessary to look up the customer code.


I don't see why coloring the field precludes the use of your lookups. The color just shows that the field is required and invalid. Once valid data is in the field it turns a different color. It doesn't matter how the data got there. The field could also be a combobox.

I would love to have a control that works like the Google toolbar field. Once you start typing it drops down a list and narrows the options the more you type the closer the match.


Perhaps you could use a combobox for this. You could update the array with each keystroke.

A dbcombo with incremental search enabled works similarly except it doesn't eliminate the display of items beyond the matching items.

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

Re: How to programmatically click on a cell of an xBrowse?

Postby Gale FORd » Thu Mar 24, 2011 5:38 pm

I thought the problem was doing something like msginfo() during the oCol get entry on xbrowse. I see it can be done with oCol:nEditType := EDIT_DATE because it does a drop down date selector.

I guess I need to do some testing and see what the limits are during the edit on xbrowwse.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: How to programmatically click on a cell of an xBrowse?

Postby hua » Mon Apr 11, 2011 2:02 am

nageswaragunupudi wrote:bEditValid of a column in XBrowse may not contain any screen I/O like MsgInfo(), etc. This could result in unexpected behavior. We may have to accept this as a limitation.


Antonio,
Can I know your opinion on this please? I got a bunch of bugs reported to me concerning my journal module that I redone using xBrowse and I just want to be sure which bugs are due to my fault and which part is because of limitation of xBrowse, if any. Thank you.

Of course, I'm still using FWH10.5 though.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests