5 Replies Latest reply on Jul 12, 2006 9:43 AM by dbohea

    Problems setting HTML font

    dbohea
      Hello people.

      I'm having troubles setting the font face in an html table that I am displaying in a text member.

      Here is what I am trying:

      -- set font for HTML
      put "<FONT FACE="ARIAL">"&RETURN after htext

      I'm getting an error message claiming that I am using a variable before it has been assigned (I assume that it thinks that ARIAL is a variable). Am I right in thinking that the extra quotation marks aren't helping?

      Any tips?
        • 1. Re: Problems setting HTML font
          Level 7
          Try either
          put "<FONT FACE=" &QUOTE& "ARIAL" &QUOTE& ">"&RETURN after htext
          or:
          put "<FONT FACE='ARIAL'>"&RETURN after htext
          • 2. Re: Problems setting HTML font
            dbohea Level 1
            That doesn't seem to be doing the trick.

            Here is the complete Lingo for the HTML table (using one of Sean Wilson's suggestions ):

            -- display a list of all the students using HTML
            on displayDatabase

            -- HTML header
            htext = "<HTML><BODY BGCOLOR=#FFFFFF>"&RETURN -- need to specify font for table display

            -- set font for HTML
            put "<FONT FACE='ARIAL'>"&RETURN after htext

            -- put the table headings
            put "<TABLE><TR><TH>Username</TH><TH>Password</TH></TR>"\
            &RETURN after htext

            -- loop through database and create table rows
            repeat with i = 1 to gDatabase.count
            put "<TR>" after htext
            put "<TD>" & gDatabase.getPropAt(i) & "</TD>" after htext
            put "<TD>" & gDatabase[gDatabase.getPropAt(i)] & "</TD>" after htext
            put "</TR>"&RETURN after htext
            end repeat

            -- close out table and HTML
            put "</TABLE></BODY></HTML>" after htext

            -- place HTML in text member
            member("Student Database Display").html = htext

            end
            --


            Any ideas?
            • 3. Problems setting HTML font
              Paul_Gray
              I have found that to get the font to display properly, I've had to add the font tag inside each of the TD tags.
              So the repeat loop would look like:

              repeat with i = 1 to gDatabase.count
              put "<TR>" after htext
              put "<TD><FONT FACE=" & QUOTE & "ARIAL" & QUOTE & ">" & gDatabase.getPropAt(i) & "</FONT></TD>" after htext
              put "<TD><FONT FACE=" & QUOTE & "ARIAL" & QUOTE & ">" & gDatabase[gDatabase.getPropAt(i)] & "</FONT></TD>" after htext
              put "</TR>"&RETURN after htext
              end repeat
              • 4. Re: Problems setting HTML font
                Level 7
                Director seems to be following a strict interpretation of the HTML Content
                Model. Under the model, if you have more than one table cell, then you have
                to set the font within each cell with an additional FONT tag. This was a
                problem for IE as well, until Microsoft 'relaxed' enforcement of the model
                for tables.

                So if you do this for example

                -- put the table headings
                put "<TABLE><TR><TH><FONT
                FACE='Arial'>Username</font></TH><TH>Password</TH></TR>" &RETURN after htext

                you will see the Username header font as Arial, but not the Password header.
                If you want to continue with this you will need to format every cell. If you
                are just using this code to display within Director, then don't bother with
                setting the font in the HTML. Just add this line to the end of your handler:

                member("Student Database Display").font = "Arial"


                • 5. Re: Problems setting HTML font
                  dbohea Level 1
                  Once again, Dave C to the rescue.

                  If only I could email you Guinness.

                  Cheers.