FoxInCloud
Disable the emission of 'BLUR' when changing row or column in a grid
Gravatar is a globally recognized avatar based on your email address. Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  All
  Mar 22, 2021 @ 10:58am

Hi Thierry,

Is it possible to disable the 'BLUR' emission form the browser when changing row or column in a grid?

The grid is READONLY = .T.

Amicalement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 23, 2021 @ 04:38am

Hi Gilles,

Don't understand what controls fires .blur(), and can't reproduce on FoxInCloud Live Tutorial's Controls and Events form (on tab # 3 'Grid')

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 23, 2021 @ 05:31am

Thierry,

In the grid 'GRILLE' (grille.readonly = .T. ) of the 'CONSULTATION' form:

PROCEDURE wAfterRowChange
LPARAMETERS tuRow && see documentation in awGrd.wAfterRowChange()

IF TYPE('THISFORM.wlHTMLgen') == 'L' AND m.THISFORM.wlHTMLgen = .T.
	&& - IGNORE EVENT: RETURN .F.
	RETURN .F.
ENDIF
ENDPROC

RETURN .F. will normaly deactivate the javascript 'BLUR' when changing row in a grid.

Is it right ?

Amicalement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 24, 2021 @ 02:11am

Hi Gilles,

.readOnly only means that user can't update data in the grid, preventing events such as .InterActiveChange() and .Valid(), all other events such as .wAfterRowChange() keep firing.

However we do have a bug in .wAfterRowChange(): return .F. when thisForm.wlHTMLgen is ignored.

Please try this fix:

modify command awHTML.prg

&& MAKE SURE TO MODIFY THE SECOND
&& .getHTML_grd_AW_cScript_Events_Grid_AfterRowChange() method!!

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_AfterRowChange && {fr} Script des événements de changement de ligne d'un grille

&& 2016-02-05 thn -- http://support.west-wind.com/Message4K31CEE05.wwt

&& ADD THIS BLOCK OF CODE

if isNullOrEmpty(Evaluate('m.this.oControl.wAfterRowChange()')) && 2021-03-24 thn -- {FiC V 2.31.1-beta.1} {en} added for https://support.west-wind.com/Thread60C0NILN2.wwt
  return ''
endif
…

thanks

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 24, 2021 @ 04:25am

Merci Thierry,

  • This patch does not bring any change, the 'BLUR' events are sent at each change of row in the grid
  • (Obviously I had knowledge of the behavior of an object whose READONLY property is true )

Amicalement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 24, 2021 @ 04:48am

Are you sure you modified the SECOND .getHTML_grd_AW_cScript_Events_Grid_AfterRowChange() method in awHTML.prg?

NB: .blur() is another event; this is .wAfterRowchange()

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 24, 2021 @ 05:21am

Oui Thierry,

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_
lparameters ;
  laAWmethod as String; && @
, lnAWmethod as Integer; && 
, lcColRow as String; && [''] {fr} script de réglage de row et col

local lcResult as String;
, llColRow as Boolean;
, liAWmethod as Integer;
, lcAWmethod as String;
, lcCRLF as String;

lcResult = ''

llColRow = !Empty(m.lcColRow)
lcColRow = Iif(m.llColRow, m.lcColRow + CRLF, '')
lcCRLF = CRLF

&& evt = jQuery.event.fix(event)
for liAWmethod = 1 to m.lnAWmethod
	lcAWmethod = m.laAWmethod[m.liAWmethod, 1] && 2014-12-01 -- thn -- http://www.activewidgets.com/JavaScript.forum.27600.2/stop-click-propagation-to-the.html
	TEXT TO lcResult additive textmerge noshow flags 1 pretext m.this.nPreText && {fr} il faut préfixer les méthodes d'événements par 'oGrid.' pour les créer
				oGrid.<<m.lcAWmethod>>{
<<m.lcColRow>><<ICase(!('Clicked' $ m.lcAWmethod or 'Mouse' $ m.lcAWmethod), '', m.llColRow, 'event.cancelBubble = true;'+m.lcCRLF, 'if(event.cancelBubble) return;'+m.lcCRLF)>><<Iif('event' $ m.lcAWmethod, 'event = jQuery.event.fix(event);'+Chr(13)+Chr(10), '')>><<Trim(m.laAWmethod[m.liAWmethod, 2], Chr(9), Chr(10), Chr(13), Chr(32))>>
				};

	ENDTEXT
endfor

return m.lcResult
endfunc

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_AfterRowChange && {fr} Script des événements de changement de ligne d'un grille

local lcResult

TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && {fr} Click() sur la ligne déclenche l'événement immédiatement
	oGrid.defineRowProperty('Clicked', false);
	if (FoxInCloud.gridRowChangeDelay > 0){
		oGrid.onRowMouseDown = function(event, row){this.setRowClicked(true, row)};
		oGrid.onRowMouseUp = function(event, row){this.setRowClicked(false, row)};
	}
	oGrid.onCurrentRowChanged = function(row){
		var value = this.getRowProperty('tuRow', row);
		if (!(this.disabled || value === null)){
			var grd = document.getElementById('<<m.this.wcID>>');
			if (FoxInCloud.gridRowChangeDelay > 0 && !this.getRowClicked(row)){
				this.nTOrow && window.clearTimeout(this.nTOrow);
				this.nTOrow = window.setTimeout(jQuery.proxy(FoxInCloud.gridMethod, FoxInCloud), FoxInCloud.gridRowChangeDelay * 1000, 'wAfterRowChange', grd, value);
			}
			else FoxInCloud.gridMethod('wAfterRowChange', grd, value);
		}
	};
ENDTEXT

RETURN m.lcResult + CRLF2
endfunc

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_AfterRowChange && {fr} Script des événements de changement de ligne d'un grille

&& 2016-02-05 thn -- http://support.west-wind.com/Message4K31CEE05.wwt
if isNullOrEmpty(Evaluate('m.this.oControl.wAfterRowChange()')) && 2021-03-24 thn -- {FiC V 2.31.1-beta.1} {en} added for https://support.west-wind.com/Thread60C0NILN2.wwt
  return ''
ENDIF

local lcResult

TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
	oGrid.defineRowProperty('Clicked', false);
	if (FoxInCloud.gridRowChangeDelay > 0){
		oGrid.onRowMouseDown = function(event, row){this.setRowClicked(true, row)};
		oGrid.onRowMouseUp = function(event, row){this.setRowClicked(false, row)};
	}
	oGrid.onCurrentRowChanged = function(row){
		var value = this.getRowProperty('tuRow', row);
		if (!(this.disabled || value === null)){
			var rowClicked = this.getRowClicked(row)
			, grd = document.getElementById('<<m.this.wcID>>');
			if (FoxInCloud.gridRowChangeDelay > 0 && (!rowClicked || FoxInCloud.gridRowChangeDelayClicked > 0)){
				this.nTOrow && window.clearTimeout(this.nTOrow);
				this.nTOrow = window.setTimeout(jQuery.proxy(FoxInCloud.gridMethod, FoxInCloud), FoxInCloud[rowClicked ? 'gridRowChangeDelayClicked' : 'gridRowChangeDelay'] * 1000, 'wAfterRowChange', grd, value);
			}
			else FoxInCloud.gridMethod('wAfterRowChange', grd, value);
		}
	};
ENDTEXT

RETURN m.lcResult + CRLF2
endfunc

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_AfterColChange && {fr} Script des événements de changement de colonne d'un grille

local lcResult

&& 2015-12-02 - thn - /!\ to do - si l'application implémente onCellMouseUp|Down, ajouter le script this.setColumnClicked(true|false, col) -- à faire dans awGrd

TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && {fr} Click() sur la colonne déclenche l'événement immédiatement
	oGrid.defineColumnProperty('Clicked', false);
	if (FoxInCloud.gridColChangeDelay > 0){
		oGrid.onCellMouseDown = function(event, col, row){this.setColumnClicked(true, col);};
		oGrid.onCellMouseUp = function(event, col, row){this.setColumnClicked(false, col);};
	}
	oGrid.onCurrentColumnChanged = function(col){
		if (!this.disabled){
			col = parseInt(col, 10);
			var grd = document.getElementById('<<m.this.wcID>>');
			if (FoxInCloud.gridColChangeDelay > 0 && !this.getColumnClicked(col)){
				this.nTOcol && window.clearTimeout(this.nTOcol);
				this.nTOcol = window.setTimeout(jQuery.proxy(FoxInCloud.gridMethod, FoxInCloud), FoxInCloud.gridColChangeDelay * 1000, 'wAfterColChange', grd, col+1);
			}
			else FoxInCloud.gridMethod('wAfterColChange', grd, col+1);
		}
	};
ENDTEXT

RETURN m.lcResult + CRLF2
endfunc


Amicalement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 25, 2021 @ 06:57am

Can you double check your code? This code works fine on the grid below

  PROCEDURE grdorders.wafterrowchange
    LPARAMETERS tuRow && see documentation in awGrd.wAfterRowChange()

    if thisForm.wlHTMLgen
      return .F.
    endif

    return DoDefault(@m.tuRow)
  ENDPROC

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 25, 2021 @ 08:51am

Thierry

I noticed that it works on tutotest, but on my project the operation is not correct. With or without modification in awHTML

modify command awHTML.prg

&& MAKE SURE TO MODIFY THE SECOND
&& .getHTML_grd_AW_cScript_Events_Grid_AfterRowChange() method!!

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_AfterRowChange && {fr} Script des événements de changement de ligne d'un grille

&& 2016-02-05 thn -- http://support.west-wind.com/Message4K31CEE05.wwt

&& ADD THIS BLOCK OF CODE

if isNullOrEmpty(Evaluate('m.this.oControl.wAfterRowChange()')) && 2021-03-24 thn -- {FiC V 2.31.1-beta.1} {en} added for https://support.west-wind.com/Thread60C0NILN2.wwt
  return ''
endif

Amicalement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 26, 2021 @ 02:31am

Hi Gilles,

Please try to debug why this code does not execute correctly:

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_AfterRowChange && {fr} Script des événements de changement de ligne d'un grille

&& 2016-02-05 thn -- http://support.west-wind.com/Message4K31CEE05.wwt

&& ADD THIS BLOCK OF CODE

if upper(m.this.oControl.Name) == 'GRILLE'
  set step on
endif

if isNullOrEmpty(Evaluate('m.this.oControl.wAfterRowChange()')) && 2021-03-24 thn -- {FiC V 2.31.1-beta.1} {en} added for https://support.west-wind.com/Thread60C0NILN2.wwt
  return ''
endif
Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 26, 2021 @ 03:32am

Thierry,

Changing a row in the grid does not pass the source code through either of the two functions!

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_AfterRowChange && {fr} Script des événements de changement de ligne d'un grille
if upper(m.this.oControl.Name) == 'GRILLE'
  set step on
endif
local lcResult

TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && {fr} Click() sur la ligne déclenche l'événement immédiatement
	oGrid.defineRowProperty('Clicked', false);
	if (FoxInCloud.gridRowChangeDelay > 0){
		oGrid.onRowMouseDown = function(event, row){this.setRowClicked(true, row)};
		oGrid.onRowMouseUp = function(event, row){this.setRowClicked(false, row)};
	}
	oGrid.onCurrentRowChanged = function(row){
		var value = this.getRowProperty('tuRow', row);
		if (!(this.disabled || value === null)){
			var grd = document.getElementById('<<m.this.wcID>>');
			if (FoxInCloud.gridRowChangeDelay > 0 && !this.getRowClicked(row)){
				this.nTOrow && window.clearTimeout(this.nTOrow);
				this.nTOrow = window.setTimeout(jQuery.proxy(FoxInCloud.gridMethod, FoxInCloud), FoxInCloud.gridRowChangeDelay * 1000, 'wAfterRowChange', grd, value);
			}
			else FoxInCloud.gridMethod('wAfterRowChange', grd, value);
		}
	};
ENDTEXT

RETURN m.lcResult + CRLF2
endfunc

* ------------------------------------------------------------
hidden function getHTML_grd_AW_cScript_Events_Grid_AfterRowChange && {fr} Script des événements de changement de ligne d'un grille

&& 2016-02-05 thn -- http://support.west-wind.com/Message4K31CEE05.wwt
if upper(m.this.oControl.Name) == 'GRILLE'
  set step on
endif
if isNullOrEmpty(Evaluate('m.this.oControl.wAfterRowChange()')) && 2021-03-24 thn -- {FiC V 2.31.1-beta.1} {en} added for https://support.west-wind.com/Thread60C0NILN2.wwt
	return ''
ENDIF

local lcResult

TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
	oGrid.defineRowProperty('Clicked', false);
	if (FoxInCloud.gridRowChangeDelay > 0){
		oGrid.onRowMouseDown = function(event, row){this.setRowClicked(true, row)};
		oGrid.onRowMouseUp = function(event, row){this.setRowClicked(false, row)};
	}
	oGrid.onCurrentRowChanged = function(row){
		var value = this.getRowProperty('tuRow', row);
		if (!(this.disabled || value === null)){
			var rowClicked = this.getRowClicked(row)
			, grd = document.getElementById('<<m.this.wcID>>');
			if (FoxInCloud.gridRowChangeDelay > 0 && (!rowClicked || FoxInCloud.gridRowChangeDelayClicked > 0)){
				this.nTOrow && window.clearTimeout(this.nTOrow);
				this.nTOrow = window.setTimeout(jQuery.proxy(FoxInCloud.gridMethod, FoxInCloud), FoxInCloud[rowClicked ? 'gridRowChangeDelayClicked' : 'gridRowChangeDelay'] * 1000, 'wAfterRowChange', grd, value);
			}
			else FoxInCloud.gridMethod('wAfterRowChange', grd, value);
		}
	};
ENDTEXT

RETURN m.lcResult + CRLF2
endfunc
Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 26, 2021 @ 04:15am

This code should execute when generating HTML at form startup, not at run time during user actions.

Are you sure that awHTML.prg is compiled OK?

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 26, 2021 @ 04:30am

Are you sure that awHTML.prg is compiled OK?

Yes, to be sure, i compile it.

Tomorrow morning, i will test again to see if "This code should execute when generating HTML at form startup, not at run time during user actions".

if upper(m.this.oControl.Name) == 'GRILLE'
  set step on
endif

Amicalement

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Mar 26, 2021 @ 11:39am

Thierry,

I tested again and I confirm to you that FoxInCloud did not call this function at any time. I put an unconditional set step on the name 'GRILLE'.

Amicalement

Gilles

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Mar 29, 2021 @ 06:02am

Hi Gilles,

.getHTML_grd_AW_cScript_Events_Grid_AfterRowChange() is the only place where FoxInCloud sets the JS code for grid's after row change event.

If it does not execute in your case:

  1. Though I doubt it's possible, maybe you have some code in your grid class
  2. You have 2 awHTML.prg at different locations, and the one you modify does not run at run-time.

Maybe we could see better if you post your generated oGrid.onCurrentRowChanged() code from screen_scx.js.

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  Apr 6, 2021 @ 07:49am

Gilles,

After further research, FoxInCloud always implements the .wAfterRowChange() event when controls contained in columns have some event code implemented in web mode. To have such code execute correctly, recno(.recordSource) must always be in sync on the server.

It may be the reason why you never get rid of this code.

Gravatar is a globally recognized avatar based on your email address. re: Disable the emission of 'BLUR' when changing row or column in a grid
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  Apr 6, 2021 @ 10:18am

Merci Thierry,

It does no matter.. Nothing is totaly perfect in this world!

Amicalement

Gilles

© 1996-2024