Using WebTextArea as button

Suppose I want a WebButton with multiple lines for its caption. Anything wrong with using a WebTextArea as ReadOnly with its MouseUp event as the “button” action?

Better use a Label with a style
https://www.dropbox.com/s/kcmed0j2eyd8rru/LabelButton.zip?dl=1

Thanks, Axel. But why is using a WebLabel better than using a WebTextArea? Is it that I don’t have to set it to ReadOnly?

Also, I never noticed I could set a Hover property in a Style. That’s great.

Actually, now that I play with this, I see the pointer is better when it’s a WebLabel.

Because WebTextArea is a text area. For starters screen readers will have no idea wtf to do with that, or users might not know that it’s a button, and assistive devices will not be able to do anything with it either (tab to select, enter to click for example)

Some things you just don’t do.

[quote=316857:@Tim Parnell]Because WebTextArea is a text area. For starters screen readers will have no idea wtf to do with that, or users might not know that it’s a button, and assistive devices will not be able to do anything with it either (tab to select, enter to click for example)

Some things you just don’t do.[/quote]

Sounds like this advice would apply to using a WebLabel as well. No?

It does. And keep in mind that using the MouseUp event in the Web framework requires a round-trip to even do anything.

The best method is to use a WebControlWrapper and create your own control that uses <button type="button">Multi<br />Line<br />Label</button>. The Xojo Web framework is using <input type="button" /> which doesn’t support multiple lines, whereas <button> does.

If you don’t get to it, I might be able to make you something at Lunch.

[quote=316864:@Tim Parnell]It does. And keep in mind that using the MouseUp event in the Web framework requires a round-trip to even do anything.

The best method is to use a WebControlWrapper and create your own control that uses <button type="button">Multi<br />Line<br />Label</button>. The Xojo Web framework is using <input type="button" /> which doesn’t support multiple lines, whereas <button> does.[/quote]

Interesting. Is this something that a future version of Xojo could break?

Just create your button with a label and use it. Be happy with your creation. Don’t listen to people giving lessons, who never use Xojo web anyway.

Who cares about a round trip for a button ?

Look at most web applications, and ask yourself if 150 ms is so important anyway, in validating a button. It is not a video game, is it ?

lol
(this was for Michel’s original much more directed at me statement, he’s since edited it to be less of a personal attack.)

When the Xojo framework changes things can break. The point of WebControlWrapper is to let you create your own objects and implement them how you need to. Changes to the Xojo framework shouldn’t affect it, but they have made changes in the past that have cause issues. Xojo is good about letting us know what they’re changing though.

For example, they made the unique namespace a requirement (instead of just a suggestion,) which caused some issues for GraffitiWeb. As another example, someone at Xojo decided that all styles should be marked as !important and it messed up styling for everything else. These are in the past now, and we just kind of deal with the change and move on.

I have made you a multi-line button control with events like Action and DoubleClick, the code is based on my Bootstrap button, so I’ve encrypted it for free use. The source will be available to anyone with a WebStudio license later today.

You can download the free-as-in-beer version here: https://dl.dropboxusercontent.com/u/10504478/mlb.zip

You should always listen to people with actual experience. I don’t happen to use Xojo Web for my personal projects because I know what I’m doing with HTML, CSS, Javascript, and PHP. They make better websites than Xojo Web apps. I do use Xojo Web for client projects that use it already, so I know how to use the framework, thanks.

[quote=316877:@Michel Bujardet]Just create your button with a label and use it. Be happy with your creation. Don’t listen to people giving lessons, who never use Xojo web anyway.

Who cares about a round trip for a button ?

Look at most web applications, and ask yourself if 150 ms is so important anyway, in validating a button. It is not a video game, is it ?[/quote]
What concerned me the most, in terms of what Tim said, is that screen readers and assistive devices would fail work with it as a button. Hadn’t thought of that.

Lucky for us it is much easier to create a native control in Xojo Web than it is in Desktop, you don’t need a plugin to do so.