'Rust Cursive EditView setText function

My EditView is:

//.addChild( 
EditView::new().fixed_width(30).with_name("customer_names") 
//)

Now when try set content:

siv.call_on_name("customer_names", |view: &mut EditView| {
    view.set_content("helloooo");
});

Does nothing. :<

However, the textviews work well! 🙈

let view = siv.find_name::<TextView>("customer_id").unwrap();
view.set_content("this is ok helloo!!");

Thanks in advance!



Solution 1:[1]

I found the problem. It didn't work because of the order of calling the functions. This is the creation of the editview:

EditView::new().fixed_width(30).with_name("customer_names") //no work

The search by name function was not finding the view. If I do so, if it finds the view:

EditView::new().with_name("customer_names").fixed_width(30) //this work ok!!

I have to put the with_name() first before other properties, otherwise it puts a wrapper on it and the editview doesn't work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Barrrettt