Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2023-01

How to insert inline {}

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ondrej Pokorny

Hello,

I'd like to use the DateTimePicker from https://getdatepicker.com .

I declared an external class
? TJSTempusDominus = class external name
'tempusDominus.TempusDominus'(TJSObject)
? public
??? constructor new(aElement: TJSElement);
??? constructor new(aElement: TJSElement; aOptions: TJSObject); ? end;

a simple constructor without options works fine:

 ? fDateTimePicker := TJSTempusDominus.new(myElement);

Can I somehow add inline options { my-property: false }?

JS-code:
window.datetimepicker1 = new tempusDominus.TempusDominus( ? document.getElementById('datetimepicker1'), { my-property: false } );

Or is there a different way how to solve this?

Thanks
Ondrej

Mgr. Janusz Chmiel
to Ondrej Pokorny

Dear elite PaS2JS developers,
I have installed Pas2js widgets by using instructions available here. https://github.com/pascaldragon/Pas2JS_Widget
Unfortunately, I have found out, that UTF8 characters set, which is being used by Lazarus produces wrong Czech specific diacritic characters inside .lfm files. When I have tried to save .lfm file with UTF8 with BOM Microsoft Edge has displaied exception. And web app could not be loaded.
Please, is there any work around to use Czech diacritic characters inside .lfm forms when I will be working with Pas2JS widgets?

Thank you for your help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20230129/1cdbfe4d/attachment.htm>

Michael Van Canneyt
to Ondrej Pokorny: I'd like to use the DateTimePicker from https://getdatepicker.com . I declared an…
Ondrej Pokorny wrote 21 lines
Hello, I'd like to use the DateTimePicker from https://getdatepicker.com . I declared an external class ? TJSTempusDominus = class external name 'tempusDominus.TempusDominus'(TJSObject) ? public ??? constructor new(aElement: TJSElement); ??? constructor new(aElement: TJSElement; aOptions: TJSObject); ? end; a simple constructor without options works fine: ? fDateTimePicker := TJSTempusDominus.new(myElement); Can I somehow add inline options { my-property: false }? JS-code: window.datetimepicker1 = new tempusDominus.TempusDominus( ? document.getElementById('datetimepicker1'), { my-property: false } );

Seems I missed this mail. So a late reply

How I do this usually, using new:

window.datetimepicker1 = new tempusDominus.TempusDominus(
  ? document.getElementById('datetimepicker1'), new(['my-property',false]));

You can recurse:
new([
'my-property',false,
'headers', new(
['content-type','application/json',
'authorization','basic ABC'
])

    ]);

The new() function exists in the JS unit.

Michael.

Ondrej Pokorny
to Michael Van Canneyt
Michael Van Canneyt wrote 42 lines
On Thu, 26 Jan 2023, Ondrej Pokorny via Pas2js wrote: > Hello, > > I'd like to use the DateTimePicker from https://getdatepicker.com . > > I declared an external class > ? TJSTempusDominus = class external name > 'tempusDominus.TempusDominus'(TJSObject) > ? public > ??? constructor new(aElement: TJSElement); > ??? constructor new(aElement: TJSElement; aOptions: TJSObject); > ? end; > > a simple constructor without options works fine: > > ? fDateTimePicker := TJSTempusDominus.new(myElement); > > Can I somehow add inline options { my-property: false }? > > JS-code: > window.datetimepicker1 = new tempusDominus.TempusDominus( > ? document.getElementById('datetimepicker1'), { my-property: false } ); Seems I missed this mail. So a late reply How I do this usually, using new: window.datetimepicker1 = new tempusDominus.TempusDominus( ?? document.getElementById('datetimepicker1'), new(['my-property',false])); You can recurse: new([ ? 'my-property',false, ? 'headers', new( ????? ['content-type','application/json', ?????? 'authorization','basic ABC' ????? ]) ?? ]); The new() function exists in the JS unit.

Great, thank you Michael!

I couldn't find it myself and ended up with TJSTempusDominusOptions = class external name 'Object'(TJSObject). Now I can make it simpler.

Ondrej

Mgr. Janusz Chmiel
to Ondrej Pokorny

Xide and Xcomponents can not be installed easily and build with Lazarus. Even when I have tried to use latest stable FPCUP deluxe there are compilation errors. I have found out, that Xide and Xcomponents are very probably The best opensource solutions to write WEB apps by using Rapid applications developments. Sure, there is also Pas2widgets components from Helios and his cooperators. Could somebody prebuild Lazarus with Xide and Xcomponents? It would bring a joy to souls of many Pascal developers.

It is so positive feeling if it is possible to create Web apps by using components list and events list? Thank you very much for yours reactions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20230207/385fb963/attachment.htm>