Page 24 of 28

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 3:26 am
by Rathinagiri
Nice contribution. We shall add this to the contrib.js.

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 4:37 am
by Roberto Lopez
HMGSCRIPT R29
- new setCurrency Textbox method:

setCurrency ( nIintDigits, nDecimals, cDecimalSeparator, cGgroupSeparator, cCurrencySymbol )

- new setMask Textbox method:

setMask ( cMask )

# digit
A alphabetic
U uppercase
L lowercase
C capitalize
? any character
\ to escape

- fixed: problems in query server module.

- changed: Browse demo (append checks for duplicates).

- changed: Query demo (getting multiple records).

- changed: Textbox demo to show how to use setMask and setCurrency.

setCurrency and setMask uses JavaScripTools library (http://javascriptools.sourceforge.net)
included now in HMGSCRIPT distribution.
Enjoy!

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 4:42 am
by Rathinagiri
That's it Roberto. :)

I think this tool includes a dynamic table too.

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 4:44 am
by Roberto Lopez
rathinagiri wrote:That's it Roberto. :)
Yeah! :)

I guess that we are ready for real world applications now.

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 5:09 am
by Rathinagiri
For whole numbers the numeric textbox is good. But with decimal, the first digit we press is taken as a number after the decimal point even though we don't press the decimal separator. This is some what different behavior from the HMG desktop counterpart.

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 12:44 pm
by Roberto Lopez
rathinagiri wrote:For whole numbers the numeric textbox is good. But with decimal, the first digit we press is taken as a number after the decimal point even though we don't press the decimal separator. This is some what different behavior from the HMG desktop counterpart.
Creating an HMG compatible inputmask in JS, is possible, but since I have not enough time to do it, I've opted for use a third party library instead.

Hopefully, I'll find enough time in the future to do it.

Of course... if a contributor can do it, all we will be very happy :)

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 2:46 pm
by Rathinagiri
While implementing the numeric mask, I have seen that, HMG compatible numeric text box is possible if we don't have currency symbol. :)

So, these are the new methods for textbox for contrib.js:

Code: Select all

TextBox.prototype.setNumericMask = function ( nDigits, nDecimals, cDecimalSeparator, cGroupSeparator, lMinusAllowed )
{
   var numParser3 = new NumberParser( nDecimals, cDecimalSeparator, cGroupSeparator, true );
   var numMask3 = new NumberMask( numParser3, document.getElementById( this.getId() ), nDigits );
   numMask3.allowNegative = lMinusAllowed;
   numMask3.leftToRight = true;
}   

TextBox.prototype.isValid = function ()
{
   return getObject( this.getId() ).mask.isComplete();
}

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 2:48 pm
by Roberto Lopez
rathinagiri wrote:That's it Roberto. :)

I think this tool includes a dynamic table too.
Yes.

Despite that, you can easily create a paged browse or grid (query based).

The only thing that you need is to write appropriate expression in cFforCondition parameter.

Let's suppose that you want the first page (20 rows) of people with last name starting win 'A'. In such case, the condition will be:

last = 'A' .AND. ( ordkeyno() >=1 .AND. ordkeyno() <= 20 )

For the second page:

last = 'A' .AND. ( ordkeyno() >=21 .AND. ordkeyno() <= 40 )

And so on...

I'm thinking in add support to browse class to make it easier, but is already very easy now.

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 4:17 pm
by Roberto Lopez
rathinagiri wrote:While implementing the numeric mask, I have seen that, HMG compatible numeric text box is possible if we don't have currency symbol. :)

So, these are the new methods for textbox for contrib.js:

Code: Select all

TextBox.prototype.setNumericMask = function ( nDigits, nDecimals, cDecimalSeparator, cGroupSeparator, lMinusAllowed )
{
   var numParser3 = new NumberParser( nDecimals, cDecimalSeparator, cGroupSeparator, true );
   var numMask3 = new NumberMask( numParser3, document.getElementById( this.getId() ), nDigits );
   numMask3.allowNegative = lMinusAllowed;
   numMask3.leftToRight = true;
}   

Regarding setNumericMask, I could modify setCurrency method to expose more NumberParser properties and have only one method with different functionalities.

Besides that, we must incorporate the included format and parse methods to set and get numbers directly to the textbox.

Re: HMGSCRIPT 2012: Programming For The Web in The Right Way

Posted: Thu Jul 05, 2012 4:30 pm
by Rathinagiri
I do agree for your valid points Roberto.

If the currency symbol is missing or an empty string, we can use as a numeric textbox.