Grid Out of Focus after Edit

Moderator: Rathinagiri

User avatar
sudip
Posts: 1444
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 4 times

Grid Out of Focus after Edit

Post by sudip » Wed Apr 29, 2009 5:28 pm

Hello,

I don't know whether it's a bug or not. I found that after editing a cell/row in a grid (especially when CELLNAVIGATION is not used), form became out of focus.

Again, I am telling, I am not sure whether it's a bug or not. :?

Please check this.

With best regards.

Sudip
With best regards,
Sudip

User avatar
Roberto Lopez
HMG Founder
Posts: 3897
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 132 times

Post by Roberto Lopez » Wed Apr 29, 2009 6:00 pm

sudip wrote:Hello,

I don't know whether it's a bug or not. I found that after editing a cell/row in a grid (especially when CELLNAVIGATION is not used), form became out of focus.

Again, I am telling, I am not sure whether it's a bug or not. :?

Please check this.

With best regards.

Sudip
I can't verufy that, so, please, if you can post a little sample, could be very useful...

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
luisvasquezcl
Posts: 1021
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Has thanked: 11 times
Been thanked: 14 times
Contact:

Post by luisvasquezcl » Wed Apr 29, 2009 7:04 pm

Lo que comenta sudip es correcto.
Sucede cuando editas la primera vez; al terminar de editar, el grid pierde el foco. Cuando vas a editar nuevamente la fila conserva el foco.
Esto no es nuevo, viene sucediendo desde varias versiones anteriores.

What sudip says is correct.
It happens when editing the first time, to finish editing, the grid loses focus. When you go back to edit the row keeps the focus.
This is not new, been happening since several earlier versions.

Regards,
Luis VAsquez

User avatar
sudip
Posts: 1444
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 4 times

Post by sudip » Wed Apr 29, 2009 7:13 pm

luisvasquezcl wrote: What sudip says is correct.
It happens when editing the first time, to finish editing, the grid loses focus. When you go back to edit the row keeps the focus.
This is not new, been happening since several earlier versions.
Yes, that is I want to say.
A small sample is :-

Code: Select all

      @ 96, 220 GRID grdCompoundRm ;
         WIDTH 300 ;
         HEIGHT 250 ;
         HEADERS { 'Raw Material', 'Qty', '%' } ;
         WIDTHS { 150, 75, 55 } ;
         COLUMNCONTROLS { { 'COMBOBOX', aRmnm }, ;
         { 'TEXTBOX', 'NUMERIC', '9999.999' }, ;
         { 'TEXTBOX', 'NUMERIC', '999.99%' }} ;
         CELLNAVIGATION ;
         edit ;
	      justify { 0, 1, 1 } ;
	      on LOSTFOCUS calctot() ;
	      COLUMNWHEN { { || .t. }, { || .t. }, { || .f. } }
Roberto, this is not a working sample. If you need I can send you my new project code also. :)

With best regards.

Sudip
With best regards,
Sudip

User avatar
Roberto Lopez
HMG Founder
Posts: 3897
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 132 times

Post by Roberto Lopez » Wed Apr 29, 2009 10:12 pm

sudip wrote: Roberto, this is not a working sample. If you need I can send you my new project code also. :)
If you could post a complete small sample, ready to compile, it will help to me a lot.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3897
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 132 times

Post by Roberto Lopez » Wed Apr 29, 2009 10:20 pm

sudip wrote:

Code: Select all

      @ 96, 220 GRID grdCompoundRm ;
         WIDTH 300 ;
         HEIGHT 250 ;
         HEADERS { 'Raw Material', 'Qty', '%' } ;
         WIDTHS { 150, 75, 55 } ;
         COLUMNCONTROLS { { 'COMBOBOX', aRmnm }, ;
         { 'TEXTBOX', 'NUMERIC', '9999.999' }, ;
         { 'TEXTBOX', 'NUMERIC', '999.99%' }} ;
         CELLNAVIGATION ;
         edit ;
	      justify { 0, 1, 1 } ;
	      on LOSTFOCUS calctot() ;
	      COLUMNWHEN { { || .t. }, { || .t. }, { || .f. } }
Your grid definition has references, to a function and an array that are unknown to me. Besides that, the eventual presence of other controls in the window or the window type could be related with the problem, so please post a complete small sample showing the problem, then I'll analyze it.

Thanks in advance.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
sudip
Posts: 1444
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 4 times

Post by sudip » Thu Apr 30, 2009 1:45 am

Hello Roberto,

I have found that an out of focus problem occurs after first time edit in Grid in CHILD windows only but not in MODAL or MAIN windows.

(My net has some problems. So I shall post a complete sample after some time)

With best regards.


Sudip
With best regards,
Sudip

User avatar
sudip
Posts: 1444
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 4 times

Post by sudip » Thu Apr 30, 2009 2:03 am

Hello Roberto,

Here is a working sample for the problem. Please run and try to change the "Qty" column of the grid first.

Code: Select all

#include "minigui.ch"

Function Main

   DEFINE WINDOW Win_1 ;
      AT 0,0 ;
      WIDTH 700 ;
      HEIGHT 560 ;
      TITLE 'Grid Edit Problem' ;
      MAIN
   
      DEFINE MAIN MENU
         DEFINE POPUP 'Test'
            MENUITEM 'Test' ACTION GridTest()
         END POPUP
      END MENU

   END WINDOW

   ACTIVATE WINDOW Win_1

Return


Function GridTest()
	
	aRmnm := {"Natural Rubber", "PVC", "Sulphur"}
	
  DEFINE WINDOW frmCompound            ;
      AT 0,0               ;
      WIDTH 635            ;
      HEIGHT 460            ;
      TITLE 'Grid'   ;
      child ;
      ON INIT FillGrid()
      
      
      @ 10, 10 GRID grdCompoundRm ;
         WIDTH 500 ;
         HEIGHT 400 ;
         HEADERS { 'Raw Material', 'Qty', '%' } ;
         WIDTHS { 150, 75, 55 } ;
         COLUMNCONTROLS { { 'COMBOBOX', aRmnm }, ;
         { 'TEXTBOX', 'NUMERIC', '9999.999' }, ;
         { 'TEXTBOX', 'NUMERIC', '999.99%' }} ;
         CELLNAVIGATION ;
         edit ;
	      justify { 0, 1, 1 } ;
	      on LOSTFOCUS calctot() ;
	      COLUMNWHEN { { || .t. }, { || .t. }, { || .f. } }       

	END WINDOW
	
   CENTER WINDOW frmCompound
   ACTIVATE WINDOW frmCompound

   RETURN

   
Function FillGrid()
	local i, aGrid := { {1, 10, 0.00}, {3, 5, 0.00}, {2, 5, 0.00}}
	frmCompound.grdCompoundRm.DeleteAllItems()
	for i = 1 to len( aGrid )
		frmCompound.grdCompoundrm.additem( aGrid[ i ] )
	next
	return nil
	

	
static function CalcTot()
   local a, i, j, aTemp := { }, mTotWt := 0.00
   
   a := frmCompound.grdCompoundRm.value
   i := a[1]
   aTemp := frmCompound.grdCompoundRm.item( i )
   if i < 1
      return
   endif

   for j = 1 to frmCompound.grdCompoundRm.Itemcount
      mTotWt += frmCompound.grdCompoundRm.cell( j, 2 )
   next
   aTemp[ 3 ] := round(aTemp[ 2 ] / iif(empty(mTotWt), 1, mTotWt)*100, 2)
   frmCompound.grdCompoundRm.item( i ) := aTemp
   
   return nil		
Thank you very much. :)

With best regards.

Sudip
With best regards,
Sudip

User avatar
Roberto Lopez
HMG Founder
Posts: 3897
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 132 times

Post by Roberto Lopez » Thu Apr 30, 2009 12:35 pm

sudip wrote:Hello Roberto,

Here is a working sample for the problem. Please run and try to change the "Qty" column of the grid first.

Code: Select all

#include "minigui.ch"

Function Main

   DEFINE WINDOW Win_1 ;
      AT 0,0 ;
      WIDTH 700 ;
      HEIGHT 560 ;
      TITLE 'Grid Edit Problem' ;
      MAIN
   
      DEFINE MAIN MENU
         DEFINE POPUP 'Test'
            MENUITEM 'Test' ACTION GridTest()
         END POPUP
      END MENU

   END WINDOW

   ACTIVATE WINDOW Win_1

Return


Function GridTest()
	
	aRmnm := {"Natural Rubber", "PVC", "Sulphur"}
	
  DEFINE WINDOW frmCompound            ;
      AT 0,0               ;
      WIDTH 635            ;
      HEIGHT 460            ;
      TITLE 'Grid'   ;
      child ;
      ON INIT FillGrid()
      
      
      @ 10, 10 GRID grdCompoundRm ;
         WIDTH 500 ;
         HEIGHT 400 ;
         HEADERS { 'Raw Material', 'Qty', '%' } ;
         WIDTHS { 150, 75, 55 } ;
         COLUMNCONTROLS { { 'COMBOBOX', aRmnm }, ;
         { 'TEXTBOX', 'NUMERIC', '9999.999' }, ;
         { 'TEXTBOX', 'NUMERIC', '999.99%' }} ;
         CELLNAVIGATION ;
         edit ;
	      justify { 0, 1, 1 } ;
	      on LOSTFOCUS calctot() ;
	      COLUMNWHEN { { || .t. }, { || .t. }, { || .f. } }       

	END WINDOW
	
   CENTER WINDOW frmCompound
   ACTIVATE WINDOW frmCompound

   RETURN

   
Function FillGrid()
	local i, aGrid := { {1, 10, 0.00}, {3, 5, 0.00}, {2, 5, 0.00}}
	frmCompound.grdCompoundRm.DeleteAllItems()
	for i = 1 to len( aGrid )
		frmCompound.grdCompoundrm.additem( aGrid[ i ] )
	next
	return nil
	

	
static function CalcTot()
   local a, i, j, aTemp := { }, mTotWt := 0.00
   
   a := frmCompound.grdCompoundRm.value
   i := a[1]
   aTemp := frmCompound.grdCompoundRm.item( i )
   if i < 1
      return
   endif

   for j = 1 to frmCompound.grdCompoundRm.Itemcount
      mTotWt += frmCompound.grdCompoundRm.cell( j, 2 )
   next
   aTemp[ 3 ] := round(aTemp[ 2 ] / iif(empty(mTotWt), 1, mTotWt)*100, 2)
   frmCompound.grdCompoundRm.item( i ) := aTemp
   
   return nil		
Thank you very much. :)

With best regards.

Sudip
Many Thanks!

I'll check it ASAP.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Roberto Lopez
HMG Founder
Posts: 3897
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 132 times

Post by Roberto Lopez » Thu Apr 30, 2009 7:59 pm

sudip wrote:Hello Roberto,

Here is a working sample for the problem. Please run and try to change the "Qty" column of the grid first.
Please add the following line to the end (prior to 'return' line) in '_HMG_GRIDINPLACEEDIT' function ('h_grid.prg' file):

Code: Select all

SETFOCUS ( _HMG_SYSDATA [3] [IDX] ) 
It should solve the problem.

Thanks for the report.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

Post Reply