@@ -21,7 +21,7 @@ pub struct SenderState {
|
||||
// actions
|
||||
actions: Vec<SenderAction>,
|
||||
// entity that will receive the message
|
||||
target: Entity
|
||||
target: Entity,
|
||||
}
|
||||
|
||||
/// Method definitions, we provide inside the `SenderState`.
|
||||
@@ -38,8 +38,11 @@ impl State for SenderState {
|
||||
// initialize the view entities
|
||||
fn init(&mut self, _registry: &mut Registry, ctx: &mut Context) {
|
||||
// create the target entity, that receives the Sender messages
|
||||
self.target = Entity::from(ctx.widget().try_clone::<u32>("target")
|
||||
.expect("ERROR: SenderState::init(): target entity not found!"));
|
||||
self.target = Entity::from(
|
||||
ctx.widget()
|
||||
.try_clone::<u32>("target")
|
||||
.expect("ERROR: SenderState::init(): target entity not found!"),
|
||||
);
|
||||
}
|
||||
|
||||
// update entities, before we render the view
|
||||
|
||||
@@ -16,8 +16,7 @@ widget!(SenderView<SenderState> {
|
||||
|
||||
impl Template for SenderView {
|
||||
fn template(self, id: Entity, bc: &mut BuildContext) -> Self {
|
||||
self.name("SenderView")
|
||||
.child(
|
||||
self.name("SenderView").child(
|
||||
Button::new()
|
||||
.text("Click me to send a message!")
|
||||
.v_align("center")
|
||||
@@ -28,7 +27,7 @@ impl Template for SenderView {
|
||||
//ctx.send_message(TestMessageAction::ToggleMessageBox, id);
|
||||
false
|
||||
})
|
||||
.build(bc)
|
||||
.build(bc),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user