Has anybody experiences in programming a tag cloud in a Xojo WebApp?
I think it could work with a canvas, g.DrawString and RealBasic.Rect for each tag to identify the clicked tag. The right boundary of the canvas should be considered to write tags in a new “line” when it doesn’t fit into the remaining space of the canvas.
My wish is to program something like this:
I searched the developer library and this forum. Perhaps someone has already programmed a tag cloud? Or there is a public code snippet I overlooked?
No public code that I’m aware but I just implemented a similar thing for a client project. It turned out to be not that difficult to do.
You have an array of tags. The tags are a class that have the data (caption and tag), width, height and position data. It also has a simple method to draw into the graphics object from the containing canvas.
I’d start off with a canvas subclass. A Tag class and start slow by creating a single tag to view. And then start adding them into an array.
[quote=236308:@Steve Upton]I realize it’s outside of normal Xojo WE coding but this type of layout is exactly what CSS “float:left” is perfect at doing.
I modified the “Scrolling container” example project in the way Steven suggested. I use weblabels that are styled by webstyles for displaying the tags. You can download the modified project here:
LabelLink is a Desktop method. In Xojo Web, StringWidth is unreliable, because unless your host is a Mac or a PC with all the fonts, Linux hosts have no GUI therefore stringwidth cannot be used.
Does anybody know, why I can’t close each embedded webcontainer with the following code?
[code] dim s as string
for i as integer = 0 to ScrollingContainer.ControlCount -1
s = ScrollingContainer.ControlAtIndex(i).Name
ScrollingContainer.ControlWithName(s).close
next i[/code]
I placed a button with the code above to the modified scrolling container example project. But not every embedded control will be closed (“deleted”). I have to press the button several times.
for i as integer = ScrollingContainer.ControlCount -1 to 0 step -1
s = ScrollingContainer.ControlAtIndex(i).Name
ScrollingContainer.ControlWithName(s).close