Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To Get Value From JavaScript!
#1
Howdy All!

I have a third party javascript component that attaches itself to a an Input control (say TIWBSInput for example). The component will update the text value of attached input control if the user changes anything.

As soon as the Text field of the TIWBSInput field is updated, I need to update a few other variables. The SetText method is virtual and I have modified it to no avail.

None of the AsyncChange, etc get called of the TIWBSInput.

So here is my question: since the Text of the TIWBSInput is obviously getting updated, how can I get notified when it does?

Thanks in advance,

Shane
Reply
#2
Hi Shane, you can get changed values using AddChangedControl("IWBSInput"); after JS changed him.
See this demo.
Reply
#3
Good day Jose!

I had already tried adding AddChangedControl but the problem is that I don't if the third party control changes the underlying subclassed controll's text.

I was reading last night that the control has some some 'callbacks'. I will need to investigate when I get a chance.

All the best,

Shane
Reply
#4
Hi Shane, another idea is add a listener change to your IWBSInput.
Code:
addEventListener("change", ....)
Reply
#5
Howdy Jose!

You wouldn't happen to have an example of how to implement an 'addEventListener' to an IW control laying around would you ?

All the best,

Shane
Reply
#6
Hi Shane, i don't know what JS you are using. I have used bootstrap-datetimepicker with an IWDBEdit, but, bootstrap-datetimepicker doesn't change my IWDBEdit. What i have to do is create a Listenner change.
Code:
$("#Data").on("dp.change", function (e) {
 AddChangedControl( "IWDBEDIT_MYDATE" )
});
Reply
#7
Howdy Jose!

I am actually starting to add my own wrappers around a few third party bootstrap controls as the default ones are '....'.

I am still experimenting but so far the best way I have found to integrate callbacks is to include the callback code in the Script property of the control and check to include the script within the tags.

I am going to experiment next to see if I can at the component (control) level just find the top level TIWAppForm by going up the Parent property and then setting then registering my control (delphi) events so I can keep everything as a neat little package.

Well, I will report back after I am done one way or the other!

All the best,

Shane
Reply
#8
Shane.. how about trying the 17 beta? A lot of the stuff you want to do is simpler in 17.
Reply
#9
Good day Big K!

I am so far behind but making good progress now. The problem I have is that my customers expect my one-man shop web application to look / work like Expedia and/or Viator.

To get that, I have to go WAY OUT OF THE BOX of the standard IW / HTML controls.

The good news is that the IW bootstrap implementation + IW it is actually not that hard to integrate some good javascript components IF YOU KNOW WHAT YOU ARE DOING! This has been a big part of my learning / frustration curve.

I have now written wrappers with properties / events / callbacks in Delphi (yuck compared to c++) over the last couple of days so I am almost ready to get back to coding my web-app!

I really do plan on looking at IW 17 as soon as I get my current web app V3 out the door!

All the best,

Shane
Reply
#10
Check this out:
https://doc.atozed.com/en/iw17/lang/delp...bootstrap/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)