mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
fixed textcallback
This commit is contained in:
parent
7b9ce6bb1c
commit
804ebd8b8c
@ -39,19 +39,19 @@ fn main() {
|
|||||||
println!("Char filter fired! This means a char was inputted.");
|
println!("Char filter fired! This means a char was inputted.");
|
||||||
Some(c)
|
Some(c)
|
||||||
}
|
}
|
||||||
fn on_completion(&mut self, _: TextCallbackData<'_>) {
|
fn on_completion(&mut self, _: TextCallbackData) {
|
||||||
println!("Completion request fired! This means the tab key was hit.");
|
println!("Completion request fired! This means the tab key was hit.");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_edit(&mut self, _: TextCallbackData<'_>) {
|
fn on_edit(&mut self, _: TextCallbackData) {
|
||||||
println!("Edit was fired! Any edit will cause this to fire.")
|
println!("Edit was fired! Any edit will cause this to fire.")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_history(&mut self, dir: HistoryDirection, _: TextCallbackData<'_>) {
|
fn on_history(&mut self, dir: HistoryDirection, _: TextCallbackData) {
|
||||||
println!("History was fired by pressing {:?}", dir);
|
println!("History was fired by pressing {:?}", dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_always(&mut self, _: TextCallbackData<'_>) {
|
fn on_always(&mut self, _: TextCallbackData) {
|
||||||
// We don't actually print this out because it will flood your log a lot!
|
// We don't actually print this out because it will flood your log a lot!
|
||||||
// println!("The always callback fired! It always fires.");
|
// println!("The always callback fired! It always fires.");
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ fn main() {
|
|||||||
|
|
||||||
struct Wrapper<'a>(&'a mut String);
|
struct Wrapper<'a>(&'a mut String);
|
||||||
impl<'a> InputTextCallbackHandler for Wrapper<'a> {
|
impl<'a> InputTextCallbackHandler for Wrapper<'a> {
|
||||||
fn on_always(&mut self, data: TextCallbackData<'_>) {
|
fn on_always(&mut self, data: TextCallbackData) {
|
||||||
*self.0 = data.str().to_owned();
|
*self.0 = data.str().to_owned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,11 +99,7 @@ fn main() {
|
|||||||
struct Wrapper2<'a>(&'a str, &'a str);
|
struct Wrapper2<'a>(&'a str, &'a str);
|
||||||
|
|
||||||
impl<'a> InputTextCallbackHandler for Wrapper2<'a> {
|
impl<'a> InputTextCallbackHandler for Wrapper2<'a> {
|
||||||
fn on_history(
|
fn on_history(&mut self, dir: HistoryDirection, mut data: TextCallbackData) {
|
||||||
&mut self,
|
|
||||||
dir: HistoryDirection,
|
|
||||||
mut data: TextCallbackData<'_>,
|
|
||||||
) {
|
|
||||||
match dir {
|
match dir {
|
||||||
HistoryDirection::Up => {
|
HistoryDirection::Up => {
|
||||||
// remove first char...
|
// remove first char...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user