简体   繁体   English

在flex中将文本输入更改为标签

[英]change a textinput into label in flex

i create a form for order a item in flex. 我创建一个表单来订购Flex中的商品。 i use <mx:TextInput /> for getting the information from client and use a <mx:Button /> for submit the information in database. 我使用<mx:TextInput />从客户端获取信息,并使用<mx:Button />在数据库中提交信息。 But client requirements is when user click on button then first show a confirmation page with details information that client give. 但是客户要求是用户单击按钮,然后首先显示一个确认页面,其中包含客户提供的详细信息。 But can't use another page or <mx:TextInput /> in this confirmation page, it will be <mx:Label /> . 但是不能使用其他页面或此确认页面中的<mx:TextInput /> ,而是<mx:Label /> After show the confirmation page if clients click on Button then submit the info. 在显示确认页面后,如果客户单击“按钮”,然后提交信息。

How can i convert a <mx:TextInput /> into <mx:Label /> with all properties in flex? 如何在Flex中将所有属性的<mx:TextInput />转换为<mx:Label /> Is it possible? 可能吗?

You don't convert the TextInput to a Label. 您不会将TextInput转换为Label。 You use a separate Label component and decide which one to show based on the state of the form. 您使用单独的Label组件,然后根据表单的状态决定显示哪个组件。 Probably the most straight forward way to do it is to have two separate forms in a view stack. 可能最直接的方法是在视图堆栈中具有两个单独的表单。 The first form contains TextInputs. 第一种形式包含TextInputs。 the other form contains Labels. 另一种形式包含标签。 When the user submits the first form, just change the selectedIndex of the view stack. 当用户提交第一个表单时,只需更改视图堆栈的selectedIndex。

ViewStack is the most appropriate thing for that, so I agree with lach. ViewStack是最适合的方法,因此我同意lach。 You don't need to use Forms, just use a ViewStack with Canvas containers: 您不需要使用Forms,只需将ViewStack与Canvas容器一起使用:

<mx:ViewStack width='100%' height='100%'>
  <mx:Canvas id='edit'>edit controls here</mx:Canvas>
  <mx:Canvas id='view'>view here</mx:Canvas>
</mx:ViewStack>

Than you can control which Canvas should be visible by changing the selectedIndex of the ViewStack. 通过更改ViewStack的selectedIndex,您可以控制哪些Canvas应该可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM