app/contacts: clicking between fields switches focus among editors

This commit is contained in:
darkfi
2026-02-23 22:23:11 +01:00
parent a9780e60db
commit 67f4963ea6
3 changed files with 20 additions and 3 deletions

View File

@@ -18,7 +18,7 @@
use darkfi_serial::deserialize;
use super::{ColorScheme, CHANNELS, COLOR_SCHEME};
use super::{edit_switch::edit_switch, ColorScheme, CHANNELS, COLOR_SCHEME};
use crate::{
app::{
node::{
@@ -299,7 +299,7 @@ pub async fn make(
)
})
.await;
let chatedit_node = node.clone();
let nickedit_node = node.clone();
layer_node.link(node);
let node = create_singleline_edit("secret_edit");
@@ -395,9 +395,19 @@ pub async fn make(
)
})
.await;
let chatedit_node = node.clone();
let secedit_node = node.clone();
layer_node.link(node);
{
let mut app_tasks = app.tasks.lock().unwrap();
edit_switch(
&mut app_tasks,
&[nickedit_node, secedit_node],
app.renderer.clone(),
app.ex.clone(),
);
}
// Make buttons for cancel and done
let node = create_layer("editbtn_layer");

View File

@@ -80,6 +80,7 @@ mod ui_consts {
use ui_consts::*;
mod contact;
mod edit_switch;
pub async fn make(app: &App, content: SceneNodePtr, i18n_fish: &I18nBabelFish) {
let window_scale = PropertyFloat32::wrap(

View File

@@ -1338,6 +1338,9 @@ impl BaseEdit {
};
self_.editor.lock().focus();
let atom = &mut self_.renderer.make_guard(gfxtag!("BaseEdit::process_focus_method"));
self_.is_focused.set(atom, true);
self_.redraw(atom);
true
}
async fn process_unfocus_method(me: &Weak<Self>, sub: &MethodCallSub) -> bool {
@@ -1356,6 +1359,9 @@ impl BaseEdit {
};
self_.editor.lock().unfocus();
let atom = &mut self_.renderer.make_guard(gfxtag!("BaseEdit::process_unfocus_method"));
self_.is_focused.set(atom, false);
self_.redraw(atom);
true
}