Grid Out of Focus after Edit

Moderator: Rathinagiri

User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Grid Out of Focus after Edit

Post by sudip »

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: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Grid Out of Focus after Edit

Post by Roberto Lopez »

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: 1258
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: Grid Out of Focus after Edit

Post by luisvasquezcl »

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: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Grid Out of Focus after Edit

Post by sudip »

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: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Grid Out of Focus after Edit

Post by Roberto Lopez »

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: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Grid Out of Focus after Edit

Post by Roberto Lopez »

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: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Grid Out of Focus after Edit

Post by sudip »

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: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Grid Out of Focus after Edit

Post by sudip »

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: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Grid Out of Focus after Edit

Post by Roberto Lopez »

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: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Grid Out of Focus after Edit

Post by Roberto Lopez »

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