Changing the field appearance after making enable = "false" to that field? - apache-flex

I am trying to make enabled="false" to one form field in my flex application. But the appearance of the field after disabling it
is looking furious. I want to change the look of the field after disabling it in my way. So can i change the look and feel of a field after disabling it ?
Thanks in advance...

I think you have to write a skin for your component.
Every skin has different states for skinning. In your case, you have to write skin for disabled state.
To get started, this tutorial might be useful - http://www.adobe.com/devnet/flex/articles/flex4_skinning.html
For detailed information on skinning, please visit http://help.adobe.com/en_US/flex/using/WSC8DB0C28-F7A6-48ff-9899-7957415A0A49.html

Yes.
Concept: -
Use constraint based layout concept.
If you are using actionscript use move()
Ex: -
button.move(100,100);
if(button.visible)
{
button1.move(button.x + button.height + 5,button.y);
}
so on....
Please add some code so that we can suggest what exactly you are looking for.

Related

How to render checked checkboxes using CSS alone?

This is may be very noobish and a bit embarrassing but I am struggling to figure out how to make checkboxes 'checked' using CSS?
The case is that if a parent has a class setup (for example) I'd like to have all the checkboxes having setup as parent to be checked. I'm guessing this is not doable in pure CSS, correct? I don't mind using JS but am just very curious if I could toggle the state of the checkboxes along with that of their parent (by toggling the class).
Here's a fiddle to play around with.
A checkbox being "checked" is not a style. It's a state. CSS cannot control states. You can fake something by using background images of check marks and lists and what not, but that's not really what you're talking about.
The only way to change the state of a checkbox is serverside in the HTML or with Javascript.
EDIT
Here's a fiddle of that pseduo code. The things is, it's rather pointless.
It means you need to adding a CSS class to an element on the server that you want to jQuery to "check". If you're doing that, you might as well add the actually element attribute while you're at it.
http://jsfiddle.net/HnEgT/
So, it makes me wonder if I'm just miss-understanding what you're talking about. I'm starting to think that there's a client side script changing states and you're looking to monitor for that?
EDIT 2
Upon some reflection of the comments and some quick digging, if you want a JavaScript solution to checking a checkbox if there's some other JavaScript plugin that might change the an attribute value (something that doesn't have an event trigger), the only solution would be to do a simple "timeout" loop that continuously checks a group of elements for a given class and updates them.
All you'd have to do then is set how often you want this timeout to fire. In a sense, it's a form of "long polling" but without actually going out to the server for data updates. It's all client side. Which, I suppose, is what "timeout" is called. =P
Here's a tutorial I found on the subject:
http://darcyclarke.me/development/detect-attribute-changes-with-jquery/
I'll see if I can whip up a jQuery sample.
UPDATE
Here's a jsfiddle of a timeout listener to check for CSS classes being added to a checkbox and setting their state to "checked".
http://jsfiddle.net/HnEgT/5/
I added a second function to randomly add a "checked" class to a checkbox ever couple of seconds.
I hope that helps!
Not possible in pure css.
However, you could have a jQuery event which is attached to all elements of a class, thereby triggering the check or uncheck based on class assignments.
Perhaps like this:
function toggleCheck(className){
$("."+className).each( function() {
$(this).toggleClass("checkedOn");
});
$(".checkedOn").each( function() {
$(this).checked = "checked";
});
}

Change WF4 ActivityDesigner theme

I want to change my rehosted activities look to:
Already tried ActivityDesignerTheme
Need to do it without using WorkflowViewElement because I don't want to lose it's behaviors (breakpoint, expanding).
If it's not possible, is there a way to change ActivityDesigner header background color?
#Will
I was annoyed too by the default behavior of the ActivityDesigner header when editing the DisplayName (especially the part where it positions the caret at the beginning of the string). I used Reflector to peek (System.Activities.Presentation.dll) at the implementation and I noticed that some of this behavior is defined in OnApplyTemplate. By just overriding this method in my custom designer class and NOT calling base.OnApplyTemplate(), I was able to make the DisplayName read only in the header (in my case that was all I needed, but I think one can play with some custom event handlers in there and tweak the behavior).
#Davi Fiamenghi
Digging around some more with Reflector in the same assembly, I found the controls used in OnApplyTemplate defined under system/activities/presentation/workflowelementdesignerdefaulttemplate.baml (System.Activities.Presentation.g.resources). That seems to be the default control template used for ActivityDesigner (<ControlTemplate x:Key="WorkflowElementDesignerDefaultTemplate" x:Uid="ControlTemplate_1" ControlTemplate.TargetType="{x:Type swd:ActivityDesigner}">). I guess one way to change the header color would be to try to "re-create" this template in your application and set it explicitly in your custom activity designer. Of course it's more involved than just copying it, since it appears to be referencing other resources defined in that assembly.
Hope this helps.

How to change the state in Adobe Flex, using ActionScript?

I`m really new to Flex and ActionScript so please be patient with me.
I want to implement this script: tinyurl.com/yafqrqb
...that is doing this "magic" : tinyurl.com/y9qg32r
...but I want to tweak it a little on InfoWindowTabbedComponent. To be more precisely I`m trying to insert links in that tabs, and when you click one the state will change.
You can see my custom InfoWindowTabbedComponent at the end of the post As you can see, right now I have 2 functions that open url`s.
What I`m trying to do is to change this:
var adobeURL:URLRequest = new URLRequest("http://www.microsoft.com" );
navigateToURL(adobeURL, "_self");
Into something that change the current state.
Can you please help me?
Here`s my custom InfoWindowTabbedComponent: http://pastebin.com/f387bc3b9
I'm not sure I understand what you want to do. If you just want to set the selected Tab, instead of calling navigateToURL() set myTabNavigator.selectedIndex (or selectedChild)
If you really want to change the state, each component has a currentState property, but then you would have to define the states first (via the tag)
And if you really want to navigateToURL() you could navigate to javascript:somefunction() and then set the application state via ExternalInterface, but that would be horribly circumstantial.
Cheers,
Jörg

How to turn on line number tooltip while scrolling infragistics ultrawebgrid

I once saw this feature in action but I don't know how to turn it on. The grid can show a tooltip with the current row number (or row ID) while dragging the scrollbar. This helps you to stop the scroll in the right place. I'm assuming some property will turn this on, but I can't find it.
Maybe it is also dependent on the scroll mode?
UPDATE:
In the image below you can see an example of the tooltip I'm looking for. This is displayed while the scrollbar is being dragged (up or down). The number in the tooltip is the row number (you can't see it in this image, way to the left in the grid). This is the same grid that I am using now. Just from a very old build of our product. Somehow this tooltip was turned off. And no one knows how to turn it back on :(
I'm pretty sure this is a built in feature of the ultrawebgrid. Not something that required extra coding.
alt text http://img138.imageshack.us/img138/6337/croppercapture.jpg
Right! Now that we've established that you have version 6.3, I've hopefully got a solution for you. I don't have 6.3 myself, but I've got a slightly later one that I think didn't have Virtual Scrolling added as a feature yet.
So try this code:
webgrid.DisplayLayout.XmlLoadOnDemandType = XmlLoadOnDemandType.Virtual;
This should automatically put a tooltip on the grid as you scroll down. Have a look here for a running sample... (and remember to choose the virtual option)
Here's hoping!
Rob G
I don't know if there's a UltraWebGrid property to simply turn on the behavior you're looking for. I almost suspect you experienced this feature in another application, perhaps not even a web based one (sorry!). I do however, know exactly what you're talking about.
As a work-around, I would suggest allowing the user to input the destination row number, and to simply "jump" to it, using this technique.
If that doesn't satisfy you, it may be possible to achieve this behavior with JavaScript. You would need to use something like this technique to get the information you need, estimate (or actually detect, if possible) the row number, and the rest is up to the GUI. I would go with the work-around described above though :)
I'm typing this from memory here as I don't have it installed on this machine and I haven't seen that setting before, but how about adding something like this to the InitializeRow event:
foreach (UltraGridCell cell in e.Row.Cells)
{
if(cell.Column.Key == "Topic") //from your grid above
cell.Title = cell.Row.Index;
}
The row object itself does not have a "Title" property from memory, but the cell does.
See if that works...
Regards,
Rob G
OK - I think I've found your illusive setting:
You can set the TipStyleScroll on the Override to Show on the Grid (this may be version dependant).
You can determine which field is displayed as the tooltip by using the ScrollTipField property of the band.
I did it like so:
myGrid.DisplayLayout.Override.TipStyleScroll = TipStyle.Show;
myTopBand.ScrollTipField = "Id";
...and it works like a charm!
If it's a really long list, sometimes setting the ScrollStyle to Deferred helps:
myGrid.DisplayLayout.ScrollStyle = ScrollStyle.Deferred;
Hope that helps...
Rob G
Once again - not sure which version you have, so to be safe here's somthing you can try from 2009 version:
myGrid.Behaviors.VirtualScrolling.Enabled = true;
myGrid.Behaviors.VirtualScrolling.TooltipVisibility = DefaultableBoolean.True;
If your scrolling mode is Deferred instead of Virtual, then the tooltip is normally enabled by default.
You can find full details about this feature here
Hope that helps,
Rob G

Flex component access other component

I have 2 components for example (editor.mxml using mx:windows), when I click an edit button, I want to get the current value from the other component's datafield? (datagrid.mxml using mx:window)
I do know how to access the main MXML's datagrid by parentDocument or Application.application method, but stumped block if I want to access other way as mentioned above. Keep the code as simple as possible.
You could either do dependency injection, that is, give component A a reference to component B so that they can communicate directly (example of tighter coupling,) or have both components communicate through a common mediator using events (example of more loose coupling.)
Both of those options would be implemented wherever it is that you're creating those components (A and B in this example) and adding them to the display list.
This might be more complicated than it deserves, and it smacks of Pattern-Fever, but you could use a mediator class that listens for the CLICK event from the button and knows enough about the other component to query its property. It could even transmit that data using a custom event, which the button listens for.
While this involves three classes instead of two, it often turns out to be easier to have two components that focus on looking good and one that worries about coordination.
Cheers
Try this:
FlexGlobals.topLevelApplication
This points Your root. From the root You can grab every element You want.
You can also add an id to the custom component like this,
<custom:Editor id="myCustomComponent">
</Editor:AddressForm>
and
access your datagrid's value like this,
var data:ArrayCollection = myCustomComponent.DatagridID.dataProvider;

Resources