Import html and css code


#1

Is any way to import HTML code in AppStudio and then type the logic of the program? If answer was yes, what about CSS code?
Thanks.


#2

Importing HTML can be done fairly easily, but you won’t have access to all the features built in to AppStudio for controls added this way.

One method is to place a Container control somewhere on a form and then append some HTML markup into it using JavaScript at run time.

Alternatively, you could place markup inside the content property of a Container at design time. That’s a less flexible option, but it allows you to just drag and drop raw markup into the property rather than having to format it like a really long string.

There are other ways too, depending on how complex your needs are.

Sub Main()
  Dim markup
  $(Container1).empty()
  markup = "<div style='padding: 16px;'>" & _
             "<button type='button'>" & _
               "HTML Button" & _
             "</button>" & _
           "</div>"
  $(Container1).append(markup)
End Sub

You can place CSS inline with your markup, use AppStudio’s Project CSS feature, or add it via JavaScript code.

Kind regards,
Doug


#3

Each Form has a HTML property - it’s under a heading called Xpert. It opens up a regular edit window. You can put the HTML there.

In this case, you probably won’t be using the drag and drop interface that the Design Screen gives you, but you will be able to see what your HTML looks like there.


#4

Thank you for your answers.