Showing paste #vniyg by alinakazi@apache.org: (Show raw paste)

<?xml version="1.0" encoding="utf-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:mx="library://ns.apache.org/royale/mx"
                   xmlns:s="library://ns.apache.org/royale/spark"
                   width="600" height="400" >
	<!-- to do: layout="absolute" minWidth="955" minHeight="600" -->
	<fx:Style>
		@namespace mx "library://ns.apache.org/royale/mx";
		
		
		mx|Label {
			position: absolute;
		}
		
	</fx:Style>
	<fx:Script>
	<![CDATA[
	import mx.collections.ArrayCollection;
	[Bindable] public var arrFontsDataProvider:ArrayCollection =
				new ArrayCollection(["Times New Roman","Arial",
					"Courier New","MS Sans Serif",
					"Bookman Old Style",
					"Monotype Corsiva",
					"Platino Linotype"]);
	]]>
	</fx:Script>

	<mx:AdvancedDataGrid id="dgItems" sortExpertMode="true" styleName="advancedDataGrid" editable="true" 
								 resizableColumns="true"  
								 horizontalScrollPolicy="auto" left="5" width="300" top="33" bottom="2" height="100%">
				
					
					<mx:AdvancedDataGridColumn dataField="cp_ItemCode" headerText="Items" />
					
					
					<mx:AdvancedDataGridColumn dataField="cp_FontSize" editable="true" textAlign="right" headerText="Font Size"
											    width="105" editorDataField="returnPN">
						
						<mx:itemEditor>
							<fx:Component>
								<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"
										  xmlns:s="library://ns.apache.org/royale/spark"
										 xmlns:mx="library://ns.apache.org/royale/mx">
									<fx:Script>
										<![CDATA[
											import mx.events.ValidationResultEvent;
											// Define a property for returning the new value to the cell.
											[Bindable] public var returnPN:Number;
											public function fn_update():void{
											vlddgTxtInput.validate().type == ValidationResultEvent.INVALID ? 0 : returnPN = dgTxtInput.value;
											}
											public function fn_change():void{

											vlddgTxtInput.validate().type == ValidationResultEvent.INVALID ? 0 : returnPN = dgTxtInput.value;
											}
										
										]]>
										
										
									</fx:Script>
									<fx:Declarations>
										<mx:NumberValidator id="vlddgTxtInput" source="{dgTxtInput}"
															property="value"
															allowNegative="false"
															decimalPointCountError="The decimal separator can only occur once."
															decimalSeparator="."
															domain="real"
															trigger="{dgTxtInput}"
															triggerEvent="change"
															precision="2"
															precisionError="The amount entered has too many digits beyond the decimal point."
															separationError="The thousands separator must be followed by three digits."
															thousandsSeparator=","/>
									</fx:Declarations>
									<s:NumericStepper id="dgTxtInput" fontFamily="Verdana" textAlign="right" maxChars="2"
													  fontSize="11" value="{data.cp_FontSize}" width="105" minimum="0" 
													  maximum="72" height="21" color="black" valueCommit="{data.cp_FontSize=dgTxtInput.value}"
													  updateComplete="fn_update();"
													  change="fn_change();"/>				
								</mx:VBox>
							</fx:Component>
						</mx:itemEditor>
					</mx:AdvancedDataGridColumn>
					
					<mx:AdvancedDataGridColumn dataField="cp_FontName" headerText="Font Name" editable="true" 
											   width="150" editorDataField="cp_FontName">
						<mx:itemEditor>
							<fx:Component>
								<mx:MXAdvancedDataGridItemRenderer
									height="22" >
									<fx:Script>
										<![CDATA[
											public function get cp_FontName(): String {
												return fontDD.selectedItem;
											}
										]]>
									</fx:Script>
									<s:DropDownList id="fontDD" top="0" left="0" right="0" bottom="0"
													dataProvider="{outerDocument.arrFontsDataProvider}"
													selectedIndex="{outerDocument.arrFontsDataProvider.getItemIndex(data.cp_FontName)}"/>
								</mx:MXAdvancedDataGridItemRenderer>
							</fx:Component>
						</mx:itemEditor>
					</mx:AdvancedDataGridColumn>
					
					
			
			</mx:AdvancedDataGrid>
</mx:Application>
Make a new paste