FoxInCloud
Column.DynamicCurrentControl
Gravatar is a globally recognized avatar based on your email address. Column.DynamicCurrentControl
  Michele
  thn@foxincloud.com
  Oct 28, 2014 @ 03:32am
I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops

Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  Michele
  Michele
  Oct 28, 2014 @ 03:53am
!SOLVED. The controls must be of the same type and the columns has to contain only the two interested controls... I add another button and delete the standard Textbox and now it works....
This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'bt1','bt2')"


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops

Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  FoxInCloud Support - Thierry N.
  Michele
  Oct 28, 2014 @ 05:01am
ciao Michele,

should work with any type of control, no explicit limitation on that
must be a bug somewhere
would be nice if we could either reproduce the issue or know the line number where it occurs

thks,


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops


-- thn (FoxInCloud)

Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  FoxInCloud Support - Thierry N.
  Michele
  Oct 28, 2014 @ 05:03am
thks for the feedback

any type and additional controls should work, must be an issue somewhere


!SOLVED. The controls must be of the same type and the columns has to contain only the two interested controls... I add another button and delete the standard Textbox and now it works....
This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'bt1','bt2')"


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops



-- thn (FoxInCloud)

Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  Michele
  Thierry Nivelet (FoxInCloud)
  Oct 28, 2014 @ 05:44am
The problem is that when i open the debug window source code is not available...


ciao Michele,

should work with any type of control, no explicit limitation on that
must be a bug somewhere
would be nice if we could either reproduce the issue or know the line number where it occurs

thks,


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops


Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  FoxInCloud Support - Thierry N.
  Michele
  Oct 28, 2014 @ 05:45am
VFP classic ...
compile awHTML


The problem is that when i open the debug window source code is not available...


ciao Michele,

should work with any type of control, no explicit limitation on that
must be a bug somewhere
would be nice if we could either reproduce the issue or know the line number where it occurs

thks,


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops




-- thn (FoxInCloud)

Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  Michele
  Thierry Nivelet (FoxInCloud)
  Oct 28, 2014 @ 06:01am
At the end of the method there is a

set datasession to m.this.nDataSessionID

with this.nDataSessionID=0



VFP classic ...
compile awHTML


The problem is that when i open the debug window source code is not available...


ciao Michele,

should work with any type of control, no explicit limitation on that
must be a bug somewhere
would be nice if we could either reproduce the issue or know the line number where it occurs

thks,


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops




Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  FoxInCloud Support - Thierry N.
  Michele
  Oct 28, 2014 @ 06:15am
OK got it, thanks
here is a hot fix:
modi comm awHTML

* ----------------------------------------------
PROTECTED FUNCTION getHTML_grd_AW_cScript_ctl_txt && Script de réglage d'un contrôle Textbox dans une colonne
LPARAMETERS ;
toControl as awTxt of aw.vcx; && Contrôle
, lcCol; && N° de colonne base 0
, lcRow; && [toutes] N° de ligne base 0
, tcType; && Type de .ControlSource

#IF NOT DEBUGMODE
TRY
#ENDIF

LOCAL lcResult;
, liDataSession;
, lcFormat;
, lcMask

lcResult = ''

lcFormat = Upper(Evl(m.toControl.Format, m.toControl.Parent.Format))

liDataSession = Set("Datasession")
set datasession to m.this.oForm.DataSessionID

#IF .F.
.Format - TYPE ALL
R Displays the format mask for the text box that is specified in the InputMask property.
The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.
#ENDIF
* lcMask = Iif('R' $ m.lcFormat, Evl(m.toControl.InputMask, m.toControl.Parent.InputMask), '') && apparemment .InputMask s'applique toujours, avec ou sans 'R' $ m.lcFormat ...
lcMask = Evl(m.toControl.InputMask, m.toControl.Parent.InputMask)

tcType = Evl(m.tcType, Type(m.toControl.ControlSource)) && fonctionne seulement dans la session de données du formulaire
tcType = Iif('D' $ m.lcFormat, 'D', m.tcType)

DO CASE

#IF .F.
.Format - TYPE C
! Converts alphabetic characters to uppercase. Use with data of Character type only.
A Allows alphabetic characters only with no spaces or punctuation marks.
F Prevents Varchar values from being padded with trailing spaces in text boxes or Varbinary values from being padded with trailing zeroes (0s).
Notes
For text boxes bound to data with Varchar type, the MaxLength property must be set to a nonzero value to permit input for the desired number of characters.
When you drag a field with Varchar type to a form, the created text box's Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field. When you drag a Grid control to a form and create TextBox controls for columns with Varchar type, the Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field.
When you drag a field with Varbinary type to a form or when you drag a Grid control to a form and create TextBox controls for columns with Varbinary type, the following occur:
Format property is set to "F".
MaxLength property is set to the maximum length multiplied by 2 for the Varchar field.
InputMask property is filled with "H" up to the value of the MaxLength property.
T Trims leading and trailing blanks from the input field.
#ENDIF

CASE m.tcType $ 'CM'

*!* Keep AW default
*!* See if a property should be added to awPublic.prg!awGrc to display as String (HTML tags not interpreted)

*!* TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire
*!* var fmt = new AW.Formats.HTML;
*!* ENDTEXT

#IF .F.
.Format - TYPE D
D Uses the current SET DATE format.
E Edits Date values as British dates.
YS Displays Date values in a short date format determined by the Windows Control Panel short date setting.
YL Displays Date values in a long date format determined by the Windows Control Panel long date setting.
#ENDIF

CASE m.tcType == 'T'

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire
var fmt = new AW.Formats.DateTimeVFP;
fmt.setDataTimezone(<<Int(GetTimeZone() * -60 * 10^3)>>);
fmt.setTextTimezone(0);
fmt.setDataFormat('ISO8601');
fmt.setTextFormat('
<<m.this.getHTML_grd_AW_cDTformat(.T.)>>');
ENDTEXT

CASE m.tcType == 'D'

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.DateVFP;
fmt.setDataFormat('ISO8601');
fmt.setTextTimezone(0);
fmt.setTextFormat('
<<m.this.getHTML_grd_AW_cDTformat()>>');
ENDTEXT

#IF .F.
.Format - TYPES NY
$ Displays the currency symbol. The ControlSource property must specify a numeric source for the text box.
^ Displays numeric data using scientific notation. The ControlSource property must specify a numeric source for the text box.
L Displays leading zeros instead of spaces in the text box. The ControlSource property must specify a numeric source for the text box.
#ENDIF

CASE m.tcType == 'Y' OR '$' $ m.lcFormat

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.Number;
fmt.setTextFormat('<<m.this.getHTML_grd_AW_cScript_ctl_txt_cYfmt()>>');
ENDTEXT

CASE m.tcType == 'N' or !Empty(m.lcMask) && thn 2014-09-30 or !Empty(m.lcMask) added because of <<a href="http://www.west-wind.com/wwThreads/default.asp?Thread=4650IARBQ&MsgId=46B02AJE5" target="top" >>http://www.west-wind.com/wwThreads/default.asp?Thread=4650IARBQ&MsgId=46B02AJE5<</a>>

IF Empty(m.lcMask)
lcResult = '###'
ELSE
lcResult = Chrtran(m.lcMask, '
9', '#')
IF NOT '
.' $ m.lcResult && No decimal, add a decimal point for ActiveWidgets
LOCAL liPoint
liPoint = Ratc('
#', m.lcResult)
lcResult = Iif(m.liPoint > 0;
, Stuffc(m.lcResult, m.liPoint+1, 0, '
.'); && ? Stuffc('###', ratc('#', '###')+1, 0, '.') == '###.'
, m.lcResult;
)
ENDIF
lcResult = Chrtran(Chrtran(Chrtran(m.lcResult;
, '
.', '¨');
, '
,', Set("Separator")); && single character
, '
¨', Set("Point"))
ENDIF

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.Number;
fmt.setTextFormat(<<cLitteralJS(m.lcResult)>>);
ENDTEXT

ENDCASE

#IF .F.
.Format - TYPE ALL
K Selects all the text when the control gets the focus.
R Displays the format mask for the text box that is specified in the InputMask property.
The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.
Z Displays the value as blank if it is 0, except when the control has focus.
Dates are also supported in these controls. The / / date delimiters are not displayed unless the control has focus.
#ENDIF

IF .T.;
AND 'Z' $ m.lcFormat;
AND m.tcType $ '
TDNY'
TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
<<m.lcResult>>
fmt.dataToText_ = fmt.dataToText;
fmt.dataToText = function(data){
return <<Iif(m.tcType $ '
NY', [parseInt(data)], [data])>> ? this.dataToText_(data) : '';
};
ENDTEXT
ENDIF

#IF NOT DEBUGMODE
CATCH TO loException
throw m.loException && renvoyé à this.getHTML()
FINALLY
set datasession to m.liDataSession
ENDTRY
#ELSE
set datasession to m.liDataSession
#ENDIF

return Iif(Empty(m.lcResult);
, '';
, '
';
+ Chrtran(m.lcResult, Chr(160), '
'); && activeWidget n'aime pas ce caractère ... && cEscaped()
+ CRLF;
+ Textmerge([oGrid.setCellFormat(fmt,<<m.lcCol>>,<<m.lcRow>>);]);
+ CRLF;
)

endfunc



At the end of the method there is a

set datasession to m.this.nDataSessionID

with this.nDataSessionID=0



VFP classic ...
compile awHTML


The problem is that when i open the debug window source code is not available...


ciao Michele,

should work with any type of control, no explicit limitation on that
must be a bug somewhere
would be nice if we could either reproduce the issue or know the line number where it occurs

thks,


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops






-- thn (FoxInCloud)

Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  Michele
  Thierry Nivelet (FoxInCloud)
  Oct 28, 2014 @ 09:25am
It seems to work...thanks


OK got it, thanks
here is a hot fix:
modi comm awHTML

* ----------------------------------------------
PROTECTED FUNCTION getHTML_grd_AW_cScript_ctl_txt && Script de réglage d'un contrôle Textbox dans une colonne
LPARAMETERS ;
toControl as awTxt of aw.vcx; && Contrôle
, lcCol; && N° de colonne base 0
, lcRow; && [toutes] N° de ligne base 0
, tcType; && Type de .ControlSource

#IF NOT DEBUGMODE
TRY
#ENDIF

LOCAL lcResult;
, liDataSession;
, lcFormat;
, lcMask

lcResult = ''

lcFormat = Upper(Evl(m.toControl.Format, m.toControl.Parent.Format))

liDataSession = Set("Datasession")
set datasession to m.this.oForm.DataSessionID

#IF .F.
.Format - TYPE ALL
R Displays the format mask for the text box that is specified in the InputMask property.
The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.
#ENDIF
* lcMask = Iif('R' $ m.lcFormat, Evl(m.toControl.InputMask, m.toControl.Parent.InputMask), '') && apparemment .InputMask s'applique toujours, avec ou sans 'R' $ m.lcFormat ...
lcMask = Evl(m.toControl.InputMask, m.toControl.Parent.InputMask)

tcType = Evl(m.tcType, Type(m.toControl.ControlSource)) && fonctionne seulement dans la session de données du formulaire
tcType = Iif('D' $ m.lcFormat, 'D', m.tcType)

DO CASE

#IF .F.
.Format - TYPE C
! Converts alphabetic characters to uppercase. Use with data of Character type only.
A Allows alphabetic characters only with no spaces or punctuation marks.
F Prevents Varchar values from being padded with trailing spaces in text boxes or Varbinary values from being padded with trailing zeroes (0s).
Notes
For text boxes bound to data with Varchar type, the MaxLength property must be set to a nonzero value to permit input for the desired number of characters.
When you drag a field with Varchar type to a form, the created text box's Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field. When you drag a Grid control to a form and create TextBox controls for columns with Varchar type, the Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field.
When you drag a field with Varbinary type to a form or when you drag a Grid control to a form and create TextBox controls for columns with Varbinary type, the following occur:
Format property is set to "F".
MaxLength property is set to the maximum length multiplied by 2 for the Varchar field.
InputMask property is filled with "H" up to the value of the MaxLength property.
T Trims leading and trailing blanks from the input field.
#ENDIF

CASE m.tcType $ 'CM'

*!* Keep AW default
*!* See if a property should be added to awPublic.prg!awGrc to display as String (HTML tags not interpreted)

*!* TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire
*!* var fmt = new AW.Formats.HTML;
*!* ENDTEXT

#IF .F.
.Format - TYPE D
D Uses the current SET DATE format.
E Edits Date values as British dates.
YS Displays Date values in a short date format determined by the Windows Control Panel short date setting.
YL Displays Date values in a long date format determined by the Windows Control Panel long date setting.
#ENDIF

CASE m.tcType == 'T'

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire
var fmt = new AW.Formats.DateTimeVFP;
fmt.setDataTimezone(<Int(GetTimeZone() * -60 * 10^3)>);
fmt.setTextTimezone(0);
fmt.setDataFormat('ISO8601');
fmt.setTextFormat('
this.getHTML_grd_AW_cDTformat(.T.)>');
ENDTEXT

CASE m.tcType == 'D'

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.DateVFP;
fmt.setDataFormat('ISO8601');
fmt.setTextTimezone(0);
fmt.setTextFormat('
this.getHTML_grd_AW_cDTformat()>');
ENDTEXT

#IF .F.
.Format - TYPES NY
$ Displays the currency symbol. The ControlSource property must specify a numeric source for the text box.
^ Displays numeric data using scientific notation. The ControlSource property must specify a numeric source for the text box.
L Displays leading zeros instead of spaces in the text box. The ControlSource property must specify a numeric source for the text box.
#ENDIF

CASE m.tcType == 'Y' OR '$' $ m.lcFormat

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.Number;
fmt.setTextFormat('this.getHTML_grd_AW_cScript_ctl_txt_cYfmt()>');
ENDTEXT

CASE m.tcType == 'N' or !Empty(m.lcMask) && thn 2014-09-30 or !Empty(m.lcMask) added because of http://www.west-wind.com/wwThreads/default.asp?Thread=4650IARBQ&MsgId=46B02AJE5

IF Empty(m.lcMask)
lcResult = '###'
ELSE
lcResult = Chrtran(m.lcMask, '
9', '#')
IF NOT '
.' $ m.lcResult && No decimal, add a decimal point for ActiveWidgets
LOCAL liPoint
liPoint = Ratc('
#', m.lcResult)
lcResult = Iif(m.liPoint > 0;
, Stuffc(m.lcResult, m.liPoint+1, 0, '
.'); && ? Stuffc('###', ratc('#', '###')+1, 0, '.') == '###.'
, m.lcResult;
)
ENDIF
lcResult = Chrtran(Chrtran(Chrtran(m.lcResult;
, '
.', '¨');
, '
,', Set("Separator")); && single character
, '
¨', Set("Point"))
ENDIF

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.Number;
fmt.setTextFormat();
ENDTEXT

ENDCASE

#IF .F.
.Format - TYPE ALL
K Selects all the text when the control gets the focus.
R Displays the format mask for the text box that is specified in the InputMask property.
The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.
Z Displays the value as blank if it is 0, except when the control has focus.
Dates are also supported in these controls. The / / date delimiters are not displayed unless the control has focus.
#ENDIF

IF .T.;
AND 'Z' $ m.lcFormat;
AND m.tcType $ '
TDNY'
TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText

fmt.dataToText_ = fmt.dataToText;
fmt.dataToText = function(data){
return <Iif(m.tcType $ '
NY', [parseInt(data)], [data])> ? this.dataToText_(data) : '';
};
ENDTEXT
ENDIF

#IF NOT DEBUGMODE
CATCH TO loException
throw m.loException && renvoyé à this.getHTML()
FINALLY
set datasession to m.liDataSession
ENDTRY
#ELSE
set datasession to m.liDataSession
#ENDIF

return Iif(Empty(m.lcResult);
, '';
, '
';
+ Chrtran(m.lcResult, Chr(160), '
'); && activeWidget n'aime pas ce caractère ... && cEscaped()
+ CRLF;
+ Textmerge([oGrid.setCellFormat(fmt,,);]);
+ CRLF;
)

endfunc



At the end of the method there is a

set datasession to m.this.nDataSessionID

with this.nDataSessionID=0



VFP classic ...
compile awHTML


The problem is that when i open the debug window source code is not available...


ciao Michele,

should work with any type of control, no explicit limitation on that
must be a bug somewhere
would be nice if we could either reproduce the issue or know the line number where it occurs

thks,


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops






Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  FoxInCloud Support - Thierry N.
  Michele
  Oct 28, 2014 @ 09:36am
does it work with a textbox and another control such as a command button?


It seems to work...thanks


OK got it, thanks
here is a hot fix:
modi comm awHTML

* ----------------------------------------------
PROTECTED FUNCTION getHTML_grd_AW_cScript_ctl_txt && Script de réglage d'un contrôle Textbox dans une colonne
LPARAMETERS ;
toControl as awTxt of aw.vcx; && Contrôle
, lcCol; && N° de colonne base 0
, lcRow; && [toutes] N° de ligne base 0
, tcType; && Type de .ControlSource

#IF NOT DEBUGMODE
TRY
#ENDIF

LOCAL lcResult;
, liDataSession;
, lcFormat;
, lcMask

lcResult = ''

lcFormat = Upper(Evl(m.toControl.Format, m.toControl.Parent.Format))

liDataSession = Set("Datasession")
set datasession to m.this.oForm.DataSessionID

#IF .F.
.Format - TYPE ALL
R Displays the format mask for the text box that is specified in the InputMask property.
The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.
#ENDIF
* lcMask = Iif('R' $ m.lcFormat, Evl(m.toControl.InputMask, m.toControl.Parent.InputMask), '') && apparemment .InputMask s'applique toujours, avec ou sans 'R' $ m.lcFormat ...
lcMask = Evl(m.toControl.InputMask, m.toControl.Parent.InputMask)

tcType = Evl(m.tcType, Type(m.toControl.ControlSource)) && fonctionne seulement dans la session de données du formulaire
tcType = Iif('D' $ m.lcFormat, 'D', m.tcType)

DO CASE

#IF .F.
.Format - TYPE C
! Converts alphabetic characters to uppercase. Use with data of Character type only.
A Allows alphabetic characters only with no spaces or punctuation marks.
F Prevents Varchar values from being padded with trailing spaces in text boxes or Varbinary values from being padded with trailing zeroes (0s).
Notes
For text boxes bound to data with Varchar type, the MaxLength property must be set to a nonzero value to permit input for the desired number of characters.
When you drag a field with Varchar type to a form, the created text box's Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field. When you drag a Grid control to a form and create TextBox controls for columns with Varchar type, the Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field.
When you drag a field with Varbinary type to a form or when you drag a Grid control to a form and create TextBox controls for columns with Varbinary type, the following occur:
Format property is set to "F".
MaxLength property is set to the maximum length multiplied by 2 for the Varchar field.
InputMask property is filled with "H" up to the value of the MaxLength property.
T Trims leading and trailing blanks from the input field.
#ENDIF

CASE m.tcType $ 'CM'

*!* Keep AW default
*!* See if a property should be added to awPublic.prg!awGrc to display as String (HTML tags not interpreted)

*!* TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire
*!* var fmt = new AW.Formats.HTML;
*!* ENDTEXT

#IF .F.
.Format - TYPE D
D Uses the current SET DATE format.
E Edits Date values as British dates.
YS Displays Date values in a short date format determined by the Windows Control Panel short date setting.
YL Displays Date values in a long date format determined by the Windows Control Panel long date setting.
#ENDIF

CASE m.tcType == 'T'

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire
var fmt = new AW.Formats.DateTimeVFP;
fmt.setDataTimezone(<Int(GetTimeZone() * -60 * 10^3)>);
fmt.setTextTimezone(0);
fmt.setDataFormat('ISO8601');
fmt.setTextFormat('
this.getHTML_grd_AW_cDTformat(.T.)>');
ENDTEXT

CASE m.tcType == 'D'

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.DateVFP;
fmt.setDataFormat('ISO8601');
fmt.setTextTimezone(0);
fmt.setTextFormat('
this.getHTML_grd_AW_cDTformat()>');
ENDTEXT

#IF .F.
.Format - TYPES NY
$ Displays the currency symbol. The ControlSource property must specify a numeric source for the text box.
^ Displays numeric data using scientific notation. The ControlSource property must specify a numeric source for the text box.
L Displays leading zeros instead of spaces in the text box. The ControlSource property must specify a numeric source for the text box.
#ENDIF

CASE m.tcType == 'Y' OR '$' $ m.lcFormat

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.Number;
fmt.setTextFormat('this.getHTML_grd_AW_cScript_ctl_txt_cYfmt()>');
ENDTEXT

CASE m.tcType == 'N' or !Empty(m.lcMask) && thn 2014-09-30 or !Empty(m.lcMask) added because of http://www.west-wind.com/wwThreads/default.asp?Thread=4650IARBQ&MsgId=46B02AJE5

IF Empty(m.lcMask)
lcResult = '###'
ELSE
lcResult = Chrtran(m.lcMask, '
9', '#')
IF NOT '
.' $ m.lcResult && No decimal, add a decimal point for ActiveWidgets
LOCAL liPoint
liPoint = Ratc('
#', m.lcResult)
lcResult = Iif(m.liPoint > 0;
, Stuffc(m.lcResult, m.liPoint+1, 0, '
.'); && ? Stuffc('###', ratc('#', '###')+1, 0, '.') == '###.'
, m.lcResult;
)
ENDIF
lcResult = Chrtran(Chrtran(Chrtran(m.lcResult;
, '
.', '¨');
, '
,', Set("Separator")); && single character
, '
¨', Set("Point"))
ENDIF

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.Number;
fmt.setTextFormat();
ENDTEXT

ENDCASE

#IF .F.
.Format - TYPE ALL
K Selects all the text when the control gets the focus.
R Displays the format mask for the text box that is specified in the InputMask property.
The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.
Z Displays the value as blank if it is 0, except when the control has focus.
Dates are also supported in these controls. The / / date delimiters are not displayed unless the control has focus.
#ENDIF

IF .T.;
AND 'Z' $ m.lcFormat;
AND m.tcType $ '
TDNY'
TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText

fmt.dataToText_ = fmt.dataToText;
fmt.dataToText = function(data){
return <Iif(m.tcType $ '
NY', [parseInt(data)], [data])> ? this.dataToText_(data) : '';
};
ENDTEXT
ENDIF

#IF NOT DEBUGMODE
CATCH TO loException
throw m.loException && renvoyé à this.getHTML()
FINALLY
set datasession to m.liDataSession
ENDTRY
#ELSE
set datasession to m.liDataSession
#ENDIF

return Iif(Empty(m.lcResult);
, '';
, '
';
+ Chrtran(m.lcResult, Chr(160), '
'); && activeWidget n'aime pas ce caractère ... && cEscaped()
+ CRLF;
+ Textmerge([oGrid.setCellFormat(fmt,,);]);
+ CRLF;
)

endfunc



At the end of the method there is a

set datasession to m.this.nDataSessionID

with this.nDataSessionID=0



VFP classic ...
compile awHTML


The problem is that when i open the debug window source code is not available...


ciao Michele,

should work with any type of control, no explicit limitation on that
must be a bug somewhere
would be nice if we could either reproduce the issue or know the line number where it occurs

thks,


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops








-- thn (FoxInCloud)

Gravatar is a globally recognized avatar based on your email address. Re: Column.DynamicCurrentControl
  Michele
  Thierry Nivelet (FoxInCloud)
  Oct 28, 2014 @ 10:01am
yes...


does it work with a textbox and another control such as a command button?


It seems to work...thanks


OK got it, thanks
here is a hot fix:
modi comm awHTML

* ----------------------------------------------
PROTECTED FUNCTION getHTML_grd_AW_cScript_ctl_txt && Script de réglage d'un contrôle Textbox dans une colonne
LPARAMETERS ;
toControl as awTxt of aw.vcx; && Contrôle
, lcCol; && N° de colonne base 0
, lcRow; && [toutes] N° de ligne base 0
, tcType; && Type de .ControlSource

#IF NOT DEBUGMODE
TRY
#ENDIF

LOCAL lcResult;
, liDataSession;
, lcFormat;
, lcMask

lcResult = ''

lcFormat = Upper(Evl(m.toControl.Format, m.toControl.Parent.Format))

liDataSession = Set("Datasession")
set datasession to m.this.oForm.DataSessionID

#IF .F.
.Format - TYPE ALL
R Displays the format mask for the text box that is specified in the InputMask property.
The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.
#ENDIF
* lcMask = Iif('R' $ m.lcFormat, Evl(m.toControl.InputMask, m.toControl.Parent.InputMask), '') && apparemment .InputMask s'applique toujours, avec ou sans 'R' $ m.lcFormat ...
lcMask = Evl(m.toControl.InputMask, m.toControl.Parent.InputMask)

tcType = Evl(m.tcType, Type(m.toControl.ControlSource)) && fonctionne seulement dans la session de données du formulaire
tcType = Iif('D' $ m.lcFormat, 'D', m.tcType)

DO CASE

#IF .F.
.Format - TYPE C
! Converts alphabetic characters to uppercase. Use with data of Character type only.
A Allows alphabetic characters only with no spaces or punctuation marks.
F Prevents Varchar values from being padded with trailing spaces in text boxes or Varbinary values from being padded with trailing zeroes (0s).
Notes
For text boxes bound to data with Varchar type, the MaxLength property must be set to a nonzero value to permit input for the desired number of characters.
When you drag a field with Varchar type to a form, the created text box's Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field. When you drag a Grid control to a form and create TextBox controls for columns with Varchar type, the Format property is set to "F", and the MaxLength property is set to the maximum length for the Varchar field.
When you drag a field with Varbinary type to a form or when you drag a Grid control to a form and create TextBox controls for columns with Varbinary type, the following occur:
Format property is set to "F".
MaxLength property is set to the maximum length multiplied by 2 for the Varchar field.
InputMask property is filled with "H" up to the value of the MaxLength property.
T Trims leading and trailing blanks from the input field.
#ENDIF

CASE m.tcType $ 'CM'

*!* Keep AW default
*!* See if a property should be added to awPublic.prg!awGrc to display as String (HTML tags not interpreted)

*!* TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire
*!* var fmt = new AW.Formats.HTML;
*!* ENDTEXT

#IF .F.
.Format - TYPE D
D Uses the current SET DATE format.
E Edits Date values as British dates.
YS Displays Date values in a short date format determined by the Windows Control Panel short date setting.
YL Displays Date values in a long date format determined by the Windows Control Panel long date setting.
#ENDIF

CASE m.tcType == 'T'

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText && GetTimeZone(): Timezone offset in milliseconds && serveur et client sont dans le même fuseau horaire
var fmt = new AW.Formats.DateTimeVFP;
fmt.setDataTimezone(<Int(GetTimeZone() * -60 * 10^3)>);
fmt.setTextTimezone(0);
fmt.setDataFormat('ISO8601');
fmt.setTextFormat('
this.getHTML_grd_AW_cDTformat(.T.)>');
ENDTEXT

CASE m.tcType == 'D'

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.DateVFP;
fmt.setDataFormat('ISO8601');
fmt.setTextTimezone(0);
fmt.setTextFormat('
this.getHTML_grd_AW_cDTformat()>');
ENDTEXT

#IF .F.
.Format - TYPES NY
$ Displays the currency symbol. The ControlSource property must specify a numeric source for the text box.
^ Displays numeric data using scientific notation. The ControlSource property must specify a numeric source for the text box.
L Displays leading zeros instead of spaces in the text box. The ControlSource property must specify a numeric source for the text box.
#ENDIF

CASE m.tcType == 'Y' OR '$' $ m.lcFormat

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.Number;
fmt.setTextFormat('this.getHTML_grd_AW_cScript_ctl_txt_cYfmt()>');
ENDTEXT

CASE m.tcType == 'N' or !Empty(m.lcMask) && thn 2014-09-30 or !Empty(m.lcMask) added because of http://www.west-wind.com/wwThreads/default.asp?Thread=4650IARBQ&MsgId=46B02AJE5

IF Empty(m.lcMask)
lcResult = '###'
ELSE
lcResult = Chrtran(m.lcMask, '
9', '#')
IF NOT '
.' $ m.lcResult && No decimal, add a decimal point for ActiveWidgets
LOCAL liPoint
liPoint = Ratc('
#', m.lcResult)
lcResult = Iif(m.liPoint > 0;
, Stuffc(m.lcResult, m.liPoint+1, 0, '
.'); && ? Stuffc('###', ratc('#', '###')+1, 0, '.') == '###.'
, m.lcResult;
)
ENDIF
lcResult = Chrtran(Chrtran(Chrtran(m.lcResult;
, '
.', '¨');
, '
,', Set("Separator")); && single character
, '
¨', Set("Point"))
ENDIF

TEXT TO m.lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText
var fmt = new AW.Formats.Number;
fmt.setTextFormat();
ENDTEXT

ENDCASE

#IF .F.
.Format - TYPE ALL
K Selects all the text when the control gets the focus.
R Displays the format mask for the text box that is specified in the InputMask property.
The mask formats data for easier entry and clearer display. For example, if the mask is 99-999, the number 12345 is displayed as 12-345 but is not stored as part of the data. Use only with Character or Numeric data.
Z Displays the value as blank if it is 0, except when the control has focus.
Dates are also supported in these controls. The / / date delimiters are not displayed unless the control has focus.
#ENDIF

IF .T.;
AND 'Z' $ m.lcFormat;
AND m.tcType $ '
TDNY'
TEXT TO lcResult TEXTMERGE NOSHOW FLAGS 1 PRETEXT m.this.nPreText

fmt.dataToText_ = fmt.dataToText;
fmt.dataToText = function(data){
return <Iif(m.tcType $ '
NY', [parseInt(data)], [data])> ? this.dataToText_(data) : '';
};
ENDTEXT
ENDIF

#IF NOT DEBUGMODE
CATCH TO loException
throw m.loException && renvoyé à this.getHTML()
FINALLY
set datasession to m.liDataSession
ENDTRY
#ELSE
set datasession to m.liDataSession
#ENDIF

return Iif(Empty(m.lcResult);
, '';
, '
';
+ Chrtran(m.lcResult, Chr(160), '
'); && activeWidget n'aime pas ce caractère ... && cEscaped()
+ CRLF;
+ Textmerge([oGrid.setCellFormat(fmt,,);]);
+ CRLF;
)

endfunc



At the end of the method there is a

set datasession to m.this.nDataSessionID

with this.nDataSessionID=0



VFP classic ...
compile awHTML


The problem is that when i open the debug window source code is not available...


ciao Michele,

should work with any type of control, no explicit limitation on that
must be a bug somewhere
would be nice if we could either reproduce the issue or know the line number where it occurs

thks,


I read in document attached to last version that Column.DynamicCurrentControl is now supported.

In my grid i want to use a button or a textbox dynamically. Is it possible ?
In desktop mode it works, but not in browser....Do the controls belong to the same type ?

This is the line of my code:

This.erp_pageframe1.Page4.TicketsAdmin.Grid1.Column5.DynamicCurrentControl = "IIF(!Empty(_Alg),'btAlg','Text1')"

In browser i have a message this error
"Session number is invalid" in awhtmlgen.gehtml_grd_aw_cscript_dynprops








© 1996-2024