Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help me out - Why on set focus the grid1.column1.text1 the interactiveChange wont fire.

Status
Not open for further replies.

bharatindia

Instructor
Dec 14, 2011
6
0
0
IN
Hi Expert,

I have spend weeks to solve it but fail to have a solution pleae help me i am stuck at this poing and cant not move forword without solving this.

Herewith I attached a zip file containing my code.

On Startup focus is on Text3, if user put C for Cash or any Bank name it display the name here and
move to the Grid for Debit part of the entry i.e, Salary A/c or Rent A/c etc.

After entering the amount it move to the next for next entry and keep on doing so till user press enter on a blank a/c field.

Then it move to the narration field text5 for narration after that it display a small accept box ,
if press “Y” or Enter key it will save the record and again move to the text3 for next voucher entry.

If user press “N” it will move to the date field and user can edit the existing “just entered data”.

User can press PgUP / PgDn when cursor are a text2 (date) or text3 (Cash /Bank)

Yes I do use the nodefault to keep the cusros on the text3 or
Thisform.grid1.column1.text1 while displaying the pick-List.

Once press PgUp key the cursor go the the text3 field and pick-list is also displayed but it is not so when
it setfocus to Thisform.grid1.column1.text1

Please Help.

Thanks and Regards.
 
 http://files.engineering.com/getfile.aspx?folder=09b0815b-e9ca-4b59-838a-20ada009114d&file=MYFILE.zip
Setfocus does not change the value of a control, neither programmatically nor interactively.
So why do you expect interaivechane to be triggerd by setfocus?

What do you want to achieve?

Bye, Olaf.
 
Hi Olaf,

If you test my code you can see that whenever the 1st column of the grid is setfocus a pick-list diaplayed having the pointer focus on the account name which is there in the 1st column of the grid. This part is perfactly ok.

But i am unable to have the same impact when i hit PgUP/PgDn keys that is my main problem.

Thanks & Regards
 
In GotFocus you call the Interactivechange method, but the grid is made visible in the Interactivechange event (not in the GotFocus).

In the Interactivechange event you have :
Code:
WORD=UPPER(ALLTRIM(THISFORM.GRID_PAYMENT.COLumn1.Text1.Value))
WLEN=LEN(ALLTRIM(WORD))
IF WLEN>0
In other words, the grid is showed only when THISFORM.GRID_PAYMENT.COLumn1.Text1.Value is not empty
So on the first row, if you press a letter or a digit, text1.value is not empty and the grid is showed.
If you simply press pgUp, text1.value is empty and nothing happens.

On the next row, if you press pgUp, Text1.Value apparently is empty, but it contains the value from the previous row (you can verify by adding a WAIT WINDOW WORD NOWAIT in the InteractiveChange event)

Code:
	IF WLEN>0
	
	WAIT WINDOW WORD NOWAIT 
	
	      WITH THIS

But after you pick a value and press enter, the Keypress event contains the updated value of the Text1.Value, i.e. nothing (empty)
You can verify by adding WAIT WINDOW 'enter ' + THISFORM.GRID_PAYMENT.Column1.Text1.Value + TRANSFORM(EMPTY(THISFORM.GRID_PAYMENT.Column1.Text1.Value)) NOWAIT in the KeyPress event
Code:
IF (nKeyCode=13)

WAIT WINDOW 'enter ' + THISFORM.GRID_PAYMENT.Column1.Text1.Value + TRANSFORM(EMPTY(THISFORM.GRID_PAYMENT.Column1.Text1.Value)) NOWAIT

   DO CASE
      CASE LEN(  ALLTRIM(THISFORM.GRID_PAYMENT.Column1.Text1.Value)  )#0

I strongly suggest to use a different approach.
This is complicated and too hard to control.

Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
 
>In GotFocus you call the Interactivechange method
So you connected the events. But this is not normal event order and if you make conditions, which are not fulfilled, of course nothing happens.

As Vilhelm-Ion says, what you have there is overcomplicating things, your approach is too complicated to control, maintain and expand.

Bye, Olaf
 
Thanks vgulielmus & Olaf for your time and valuable suggestion.

Let me tell you that i have completed the whole project with the same approach it works excellent if fact it behave in the manner i want it to be.

This feature (i.e press the PgUp/PgDn key in any Voucher Entry module be it Receipt, journal or Payment like this is the only functionality left out which i now want to incorporate.

My logic/approach may look like old xbase type but i want it to be this way only.

When i hit PgUp/PgDn keys it increment/decrement the voucher no shown on the top of the screen either -1 or +1 depending upon the keypress, then i select those records from table JPR where voucher no = "voucher no shown in the form" and type="Pymt".

So with every PgUp/PgDn keys it fetch the required data from the table, it means the grid always contain the correct data.

Yes i call the Interactivechange event from the grids getfocus but it wont fetch anything if the column value is blank, it only fetch if there is some value in the column1

And since pgup/pgdn fetch fresh data for each and every stored voucher_no it will have alyaws data in column1 atleast one record
must be there, if it is there it will display the list of accounts having focus on the same account name as in the grid.column1.

But the poblem is that though thisform.grid.column1.text1.value show the correct value it does not enter into the Interactivechange event and why it is not enter becouse i call it within gotfous procedure.

One if it enters in this i think my problem will be solved as the same code work perfactly ok.

And once it dispay the pick-list editing of that voucher values will be very easy.

I think i am able to put my thought clearly.

Expecting your help.

I am sure to have a solution from this esteemed forum.

Does it has anything to do with grid re-creation ?
Thanks & Regards


 
 http://files.engineering.com/getfile.aspx?folder=5f5ab3aa-979d-4ca1-a29c-5a374603be2f&file=MYFILE.zip
I haven't read this in detail, but I'm wondering if your issue might be that you're changing something programmatically rather than through the user interface. If so, you may need the ProgrammaticChange event rather than the InteractiveChange event.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top