Skip to content

Commit

Permalink
Rename on_create to on_build. Run fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
geom3trik authored and robbert-vdh committed Apr 24, 2022
1 parent 26cce07 commit ee97c71
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions core/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<'a, T> Handle<'a, T> {
self
}

pub fn on_create<F>(self, callback: F) -> Self
pub fn on_build<F>(self, callback: F) -> Self
where
F: Fn(&mut Context),
{
Expand Down Expand Up @@ -401,6 +401,4 @@ impl<'a, T> Handle<'a, T> {
set_style!(border_radius_top_right, Units);
set_style!(border_radius_bottom_left, Units);
set_style!(border_radius_bottom_right, Units);


}
3 changes: 2 additions & 1 deletion core/src/views/value_slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ where
Binding::new(cx, VSDataInternal::edit, move |cx, edit| {
if edit.get(cx) {
Textbox::new(cx, lens.clone().map(|val| format!("{:.2}", val)))
.on_create(|cx| {
.on_build(|cx| {
cx.emit(TextEvent::StartEdit);
cx.emit(TextEvent::SelectAll);
})
Expand All @@ -67,6 +67,7 @@ where
.on_edit_end(|cx| {
cx.emit(ValueSliderEvent::SetEdit(false));
})
.background_color(Color::transparent())
.child_space(Stretch(1.0))
.height(Stretch(1.0))
.width(Stretch(1.0));
Expand Down
2 changes: 1 addition & 1 deletion examples/value_slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Model for AppData {
}

fn main() {
let mut window_description = WindowDescription::new();
let window_description = WindowDescription::new().with_title("Value Slider");
Application::new(window_description, |cx| {
AppData { val: 0.5 }.build(cx);

Expand Down

0 comments on commit ee97c71

Please sign in to comment.