setFocus in Flex - actionscript-3

I'm Using following code in flex4 mxml That works fine.
<mx:Button label="Set focus to Username"
click="focusManager.setFocus(username);" />
How to use the same in Action script I mean creation complete event of an application without using button.
That is I have login panel in application While page loads the
username field should focused having cursor in it.
Can any one help me?

The issue is that within your application the TextInput has focus, but within the HTML page your Flex application does not. So basically the only extra step you need is to give the Flex app focus. There's only one way to achieve this: through JavaScript. And you should do it after the application was loaded.
The guys at Farrata wrote a very good example on how to do this, so I'm just going to point you there: http://flexblog.faratasystems.com/2011/12/15/setting-focus-in-flex-components

Related

Tab through a webpage manually

I am trying to navigate through a webpage using just my keyboard. Through the use of my tab key I can enter in data into several input boxes, and press several submit buttons.
However I run into a problem when trying to set focus to an image element on the page. For some reason it does not allow me to select it with the tab key. I can click on it with my mouse and then a popup appears but this really slows down efficiency.
I have considered creating a script in VBA to do this but right now I would prefer a quick-fix without having to spend hours developing a macro.
NOTE: I did quickly try to assign the reference to the <img> element and use the Click and Focus methods in VBA but that didn't work. I don't get an error, the code runs fine but nothing happens on the webpage. This leads me to think that this will be a bigger project than it appears, hence my reluctance to go down that path.
I did a bit of research and it seems that tabindex is not supported by the <img> element. Does that mean what I am trying to accomplish is impossible with the keyboard? Is code my only option?
If anyone knows anything that could help in VBA by all means I will take your advice into consideration.
Unfortunately the webpage is password protected and its a company account therefore I cannot post it.
After right-clicking inspect element in my Chrome browser this is what I see:
<img alt="View Quantities At Other Locations" src="/WebOrder/Images/CheckQtys.gif"
title="View Quantities At Other Locations" class="popup"popupdirection="upperleft"
popupwidth="380" popupcontent="#ProductQuantitiesForAccessibleBranches"
onbeforepopupcreate="onBeforePopupCreate_GetProductQuantitiesForAccessibleBranches(this)"
popupajaxformid="GetProductQuantitiesForAccessibleBranches"
onbeforepopupajaxpost="onBeforePopupAjaxPost_GetProductQuantitiesForAccessibleBranches(this)"
oncompletepopupajaxpost="onCompletePopupAjaxPost_GetProductQuantitiesForAccessibleBranches(this)"
productguid="00000000-0000-0000-0000-000000058927" displayitem="732899500"
brandguid="00000000-0000-0000-0000-000000000000" brandname="" brandsku="">
Does anyone have any ideas how I can set focus to this element (either with my keyboard or VBA)?
You can focus on a div using <div tabindex=0> Stuff Here </div>. Place the image inside the div and use the div to manipulate it.

Suggestions for a Flipview with Pages inside (Windows 8.1 app)

I'm trying to create an app which shows a different page on swiping left or right.
I'm using the flipview control and loading it with Page class objects.
It works well, but when I select a textbox inside, the control recieving the focus is the flipview instead of the textbox, and then the keyboard covers it.
My question is, how I should implement his UI?
The actual structure is something like (this is not real code, but the simpliest way to show the structure)
<Page>
<FlipView> <---- This gets the focus instead of the textbox
<SetupPage>
<TextBox1 /> <--- This textbox is clicked and shows the keyboard
</SetupPage>
<AnalyzePage>
<TextBox2 />
</AnalyzePage>
</Flipview>
</Page>
I've tried using FlipViewItem around the pages, and also trying to override the focus logic of the flipview. I haven't suceeded in any case.
Thanks!

Adding a interactive gui to my VB.net application

OK. So first, I will try my best to explain so good. My friend has gotten cursed out on this forum for not explaining, so I will explain. :)
Ok so I have my program built and all. But then it hit me! Wouldn't it be better to add a news feature? One teeny tiny problem? I cant? How would I implement a interactive code into an HTML page.
Like can i connect a button to a URL that will make the program do something. Almost like you can open cydia tweaks with there identifier and url EXAMPLE: http://handleopenurl.com/scheme/cydia And then i can add urls so i can update the program, without updating the files.
Or even just a featured news thing would be nice. But how would i implement this perfectly. I tryed a webrowser, but the page is too big for it. I am good at html, not much at css, i mostly use Adobe Muse http://www.adobe.com/Muse
Last question. Kinda defies the first thing i said about having my program finished.
Is there a way i can add a plus button and make it add more buttons and more labels and all?
This would help with allowing users to customize more then what the program can handle. By The Way, its a winter board Theme Maker. So I have a bunch of icons with there bundle identifiers and I create the folders with VB.net and all that stuff. But i want users to be able to click a plus button to add MORE text boxes and file browsers.
Any ideas? Maybe DIM 1 as NewFileBrowser? But i need to move all the buttons and i need it to be able to be clicked an infinity amount of times. I can do the coding for all of these buttons, but i jest need to know how to create them <1 Move them and the button so that the button goes further down each time, and more boxes will go further down. Much help apreciated. THANKS:)
EDIT:
Are you trying to say that you're wondering how to have a web browser control in a vb.net >app, which displays a web page, and when a button is clicked on the page, your app detects >it and does something? – Thraka
That sums up the top part. I am using windows forms, and it is coded in VB.net
If you get the object you want, like the button, you can hook the event and have it call code in your form.
Find the object using the Browser.Document.GetElementById method.
With that object, add an event handler to the Click event.
See http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelementeventhandler(v=vs.110).aspx for information about the event handler used

Is it possible to bind a command directly to an app bar button?

I'm creating an MVVM style application for windows phone. With a regular button, you can bind anything that inherits from ICommand to the Command property on a xaml button, like so:
The command property does not seem to exist for buttons in the phones app bar ("shell:ApplicationBarIconButton"). Has anyone figured out how to bind their click event to a Command yet?
It's not possible from the SDK directly, but the AppBarUtils library ( http://nuget.org/packages/AppBarUtils or http://appbarutils.codeplex.com/ ) works nicely.
The codeplex site has example code for different scenarios such as reusing or switching the app bar in a page.
I didn't understand how to use the chosen solution so I went for another one. You just add the library via nuget. It's BindableApplicationBar
Then you just add the following instead of your normal application bar.
<bindableApplicationBar:Bindable.ApplicationBar>
<bindableApplicationBar:BindableApplicationBar >
<bindableApplicationBar:BindableApplicationBarButton
Text="Refresh"
IconUri="/Images/refresh.png"
Command="{Binding RefreshCommand}" />
</bindableApplicationBar:BindableApplicationBar>
It's just a shame that intellisense doesn't reconize the tags. Otherwise, it works like a charm.

Primefaces - using dialogs and layouts

I have a (JSF 2.0/ Primefaces 2.2RC-SNAPSHOT) app that has
<p:layout>
I use a lot of dialog in my application and before the newest version of primefaces came out there was no way to display a dialog with a modal on top of the layout without putting the dialogs outside of the tags.
So I did just that. The issue I am having now is I am noticing that constructors and postcontructs are being called when my application is loaded. This is because the view with the layout is being loaded and therefore all my dialogs are being loaded.
I don't want these constructors being called until I am actually dealing with the appropriate views in my application.
I have been testing the appendToBody attribute on the
<p:dialog>
tag but it seems really buggy. Everything works fine on the initial rendering of a view. I can open a dialog close it etc and it works fine. If I navigate away to another view and then come back to the initial view and open the dialog, everything is running off the page. The dialog window is in the correct place but the content is not.
My question is 1. Is there a way I can have the dialog windows outside of my layout as a child of the
<h:body>
without having all the managed bean constructors associated with them initiated when the application loads?
Or does anyone know how to fix the alignment issue when using the appendToBody tag? Thanks.
When using layout and dialog, I usually place my dialogs outside of the layout as a direct child of the body element. I have a special ui:insert part in my page template for this.
appendToBody was added to make this easier, if it doesn't work well for you, give this approach a try. I know modal dialogs and layout can work this way.
without having all the managed bean constructors associated with them
initiated when the application loads
Maybe the managedbean gets loaded when your dialog is rendered.
Try rendering the dialog only after the button click, perhaps byputting rendered="#{mybean.flagLoadMyDialog}" on the dialog, and set the flagLoadMyDialog when the button is clicked using ajax.
Also remember to ajax-update the dialog after the button click.