How to setFocus on Apache Royale Jewel Button? - button

All is in the title...
I would like to trigger at application startup this definition in css :
.jewel.button:focus
But I don't see any setFocus or focus property on j:Button
Could you tell me how to do ? Thanks
Regards

UPDATE: This is no longer right. Recently SetFocus bead was removed and StyledUIBase got "setFocus" method. Use it instead of the code below.
Use the Basic bead SetFocusrecenlty added:
<j:Button text="Hello!" emphasis="secondary">
<j:beads>
<js:SetFocus enableFocus="true"/>
</j:beads>
</j:Button>

Related

Change not-allowed cursor on drag in React

When I drag an image in react that has draggable set to true, I get not-allowed / no-drop cursor. I can't figure out how to target it with CSS to overwrite. The way I handle the drag is onDragStart then onDragEnd.
Without some reproducable code i just can try a shot in the dark: You have to call at the beginning of your drag handler e.preventDefault();.
I faced the same issue back when I was working on one of my React projects, so I did some research and tested several methods that I found, but nothing worked for me. You see there is a property named DataTransfer.effectAllowed that specifies the effect that is allowed for drag operation, and there is a limitation to this API as you can read here -
https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/effectAllowed
Changing the styles or attaching an eventListener won't work, you have to use a different backend for this. Use react-dnd and react-dnd-touch-backend or react-dnd-html5-backend npm packages as a custom backend.
https://www.npmjs.com/package/react-dnd
https://www.npmjs.com/package/react-dnd-touch-backend
https://www.npmjs.com/package/react-dnd-html5-backend

target selector not working

I don't know if the problem is related to Angular or I'm making a mistake.
I have an <article id="about">, a link <a href="#about"> and I'm trying to style the targeted element with
:target{
border: solid 1px red;
}
when I click the link the article should have a red border, shouldn't it?. When I click the link the URL off course changes from /company to /company#about but nothing happens, I also checked in the console with JQuery $(':target') and it returns null.
I thought that maybe it's Angular related, where routing mechanism interferes with some default behavior. I'm using $locationProvider.html5Mode(true), Angular 1.1.4 and Chrome26.
EDIT: Finally got a non-working example here , it works until I inject $location in app.run().
This is due to a browser bug: https://bugs.webkit.org/show_bug.cgi?id=83490
See also the last section at http://css-tricks.com/on-target/
Just a guess but:
I think the click event may be returning "false".
That is to say, some code runs, and the default link clicking behaviour is over-ridden.
Try entering the page url, with the hash at the end, into an empty tab. If your :target css works in that case, you'll know it's a javascript thing.
Perhaps the framework adds a class, or some other identifier, which you could easily style? Or maybe if you inspect the DOM, a reference to it is stored in some object, which you could style with jQuery?
If you put target="_self" in the a tag it will solve the issue with the angular routing as long as HTML5 mode is enabled.

How to run clickHandlers on buttons moved from main view component to header bar

I've used JRab's example here http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/App-specific-system-menu/td-p/693... to add a header menu to my app. What I'm having trouble with is executing my functions from the header mennu. For example, my firstView is appHome.mxml. It instantiates a Canvas object that has an erase(). There is a button in appHope.mxml that executes the erase() on the Canvas instance. I'm trying move the Erase button out of my appHome.mxml and into my headerMenu.mxml but don't know how to execute the erase() on the Canvas instance. The first thing I thought to try was click="{appHome.myCanvas.erase()}" but obviously that didn't work.
I asked a similar question yesterday here: Flex executing a function on another view and I accepted the answer before I tried it. The problem is that the headermenu.mxml is not a child of appHome.mxml. They are both children of the main app.mxml. Secondly, the object that has the erase() is in a separate .as class I instantiate in appHome.mxml.
I hope I described my question well enough. Thanks n advance to anyone that can help.
Based on your description, I don't understand how my comment on the previous answer doesn't answer it.
The event from headermenu dispatches up to app; which can call the method on it's child (appHome) like this:
appHome.erase()

html: Unexpected call to method or property access

I am trying to use Rounded Corner buttons in my ASP.NET website using AjaxControlToolkit's RoundedCornerExtender. When I use this on a Buton control, I get an error saying "htmlfile: Unexpected call to method or property access" to which I can Break/continue.
When I run the sites, it gives me an error "Unexpected call to mathod or property access".Here's the screenshot: http://img29.imageshack.us/img29/7051/roundedcornersp.png
Not my are of expertise, but I would guess this does not work on a button control.
You could try using a div as button.
Here is the same discussion:
http://forums.asp.net/p/1352765/2766571.aspx
Probably not the answer you're looking for, but is there something wrong with using other purely javascript solutions to rounded corners that are out there?

How to give alert message without using javascript

Hai to all,
How can i give alert message with ok and cancel button within dataset function.if ok procced further else return in asp.net .......pls help
You can't show a client-sided message-box without using client-sided script.
It isn't possible. Both a standard browser alert window and a lightboxed one require JavaScript to display.
If you don't want to handcode the JavaScript, you can use the ASP.NET Ajaxtoolkit (http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ModalPopup/ModalPopup.aspx) which contains a ModelPopup control that handles it for you.
Add an "onclick" attribute to the object.
Page_load(){
object.Attributes.Add("onclick", "javascript:confirm('Are you sure')");
}
something like that.
You could use basic html to create a page that only has a small form in the centre of the page.
This would eliminate javascript.

Resources