mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add get_radiobutton docs
This commit is contained in:
parent
74c8bff8b3
commit
5ae52fc490
2 changed files with 30 additions and 0 deletions
BIN
docs/images/modals_get_radiobutton.png
Normal file
BIN
docs/images/modals_get_radiobutton.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
|
|
@ -607,6 +607,36 @@ impl Modals {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Creates modal dialog from list of items (list created by add_list or add_list_item) and returns String
|
||||
/// value of selected item.
|
||||
/// - Dialog cannot be dismissed without pressing 'ok'.
|
||||
/// - 'ok' text is not editable.
|
||||
/// - Any or none of the checked items are acceptable to be returned.
|
||||
///
|
||||
/// <details>
|
||||
/// <summary>Example Image</summary>
|
||||
///
|
||||
/// 
|
||||
///
|
||||
/// </details>
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use modals::Modals;
|
||||
/// use xous_names::XousNames;
|
||||
/// let xns = XousNames::new().unwrap();
|
||||
/// let modals = Modals::new(&xns).unwrap();
|
||||
///
|
||||
/// const RADIO_TEST: [&'static str; 4] = ["zebra", "cow", "horse", "cat"];
|
||||
///
|
||||
/// for item in RADIO_TEST {
|
||||
/// modals.add_list_item(item).expect("couldn't build radio item list");
|
||||
/// }
|
||||
/// match modals.get_radiobutton("Pick an animal") {
|
||||
/// Ok(animal) => log::info!("{} was picked", animal),
|
||||
/// _ => log::error!("get_radiobutton failed"),
|
||||
/// }
|
||||
/// ```
|
||||
pub fn get_radiobutton(&self, prompt: &str) -> Result<String, xous::Error> {
|
||||
self.lock();
|
||||
let spec =
|
||||
|
|
|
|||
Loading…
Reference in a new issue