[view] add AlertView
This commit is contained in:
21
src/main/haxework/view/popup/AlertView.hx
Normal file
21
src/main/haxework/view/popup/AlertView.hx
Normal file
@@ -0,0 +1,21 @@
|
||||
package haxework.view.popup;
|
||||
|
||||
import haxework.view.form.LabelView;
|
||||
import haxework.view.text.TextView;
|
||||
import promhx.Promise;
|
||||
|
||||
@:template class AlertView extends PopupView<Dynamic> {
|
||||
|
||||
@:view var header:LabelView;
|
||||
@:view var message:TextView;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static function alert(message:String):Promise<Dynamic> {
|
||||
var result = new AlertView();
|
||||
result.message.text = message;
|
||||
return result.show();
|
||||
}
|
||||
}
|
||||
31
src/main/haxework/view/popup/AlertView.yaml
Normal file
31
src/main/haxework/view/popup/AlertView.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
view:
|
||||
$type: haxework.view.group.VGroupView
|
||||
geometry.width: 400
|
||||
geometry.height: 200
|
||||
geometry.padding: 10
|
||||
geometry.hAlign: center
|
||||
geometry.vAlign: middle
|
||||
style: frame
|
||||
views:
|
||||
- $type: haxework.view.group.HGroupView
|
||||
geometry.width: 100%
|
||||
layout.margin: 10
|
||||
views:
|
||||
- id: header
|
||||
$type: haxework.view.form.LabelView
|
||||
- id: message
|
||||
$type: haxework.view.form.LabelView
|
||||
font.align: CENTER
|
||||
layout.hAlign: center
|
||||
layout.vAlign: middle
|
||||
geometry.width: 100%
|
||||
geometry.height: 100%
|
||||
- $type: haxework.view.group.HGroupView
|
||||
geometry.width: 100%
|
||||
layout.hAlign: center
|
||||
layout.margin: 10
|
||||
views:
|
||||
- $type: haxework.view.form.ButtonView
|
||||
text: OK
|
||||
+onPress: ~close('ok')
|
||||
Reference in New Issue
Block a user