I am currently searching the internet for information and samples on TIWJQueryWidget, but unfortunately, I have not been successful in finding any relevant resources. My aim is to present a barcode on an Intraweb page. However, I am facing difficulties in implementing TIWJQueryWidget.
I would be grateful for any assistance you could provide. Thank you.
Here are the steps to do it:
Download the JsBarcode library from the official website: https://github.com/lindell/JsBarcode
Extract the downloaded files and copy the "JsBarcode.all.min.js" file into your Intraweb project directory.
In your Intraweb form, add a TIWHTMLPanel component and set its Height and Width properties to the size you want the barcode to be.
In the OnRender event of the TIWHTMLPanel, add the following code:
procedure TForm1.IWHTMLPanel1Render(Sender: TObject);
BarcodeValue := '123456789'; // Set the value of the barcode here
BarcodeCanvas := TIWCanvas.Create(Self);
BarcodeCanvas.Width := IWHTMLPanel1.Width;
BarcodeCanvas.Height := IWHTMLPanel1.Height;
BarcodeCanvas.JSInterface.JSCode.Add('JsBarcode("#' + IWHTMLPanel1.HTMLName + '", "' + BarcodeValue + '");');
IWHTMLPanel1.Canvas.Draw(0, 0, BarcodeCanvas);
In the Uses section of your unit, add the following line:
This will allow you to use the TIWCanvas component.
Finally, in the OnBeforeRender event of your form, add the following line to include the JsBarcode library in your page:
That's it! When you run your Intraweb application, the barcode should be displayed in the TIWHTMLPanel. Note that you can change the value of the barcode by modifying the BarcodeValue variable in the OnRender event.