Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change from choice to inputchoice in fldialect nad add search function #33

Merged
merged 26 commits into from
Jul 11, 2024
Merged

change from choice to inputchoice in fldialect nad add search function #33

merged 26 commits into from
Jul 11, 2024

Conversation

theavege
Copy link
Contributor

No description provided.

@theavege
Copy link
Contributor Author

theavege commented May 16, 2024

@MoAlyousef How can You add InputChoice.value_index() -> Some(i32)? How to remove nesting in InputChoice.add("https://fltk-rs.github.io/fltk-book/")? For example FlResters.

@MoAlyousef
Copy link
Collaborator

I can try adding InputChoice::value_index() since FLTK doesn’t expose it. Regarding the nesting, you would have to escape the forward slashes with a backslash. The string has to be a string literal: r#"http:\/\/site"

@theavege
Copy link
Contributor Author

@MoAlyousef , I can't understand the strange behavior in cairo_shadow_button. Can You help me?

@MoAlyousef
Copy link
Collaborator

set_label cause a widget to redraw, i.e invoking the draw method again and again.

@theavege
Copy link
Contributor Author

theavege commented May 24, 2024

@MoAlyousef , sorry, I didn't understand. Why does window.set_label("") work, but frame.set_label("") don't work correct? Why does browser don't redraw correct in examples FlPicture and CSV?

@theavege
Copy link
Contributor Author

@MoAlyousef can you add a method frame.draw_label() without redraw()?

@MoAlyousef
Copy link
Collaborator

Anything which causes a redraw like browser.clear() and frame.set_labe() if called inside the draw callback would cause issues.
How would frame.draw_label() be implemented, it would still require adding a draw::draw_text or something to the draw handler.

@theavege
Copy link
Contributor Author

theavege commented May 27, 2024

@MoAlyousef The GlobalState is very usefully. I remade demos cairo_button, csv and flpicture with GlobalState and widget.handle(), but browser.handle() don't correct work in flpicture's demos. Need examples with MVC + GlobalState.
I think that storing widgets in a structure and storing data in widgets is not the right approach. I think it's better to use GlobalState and widget update method (perhaps app::handle_main(Event::from_i32(HEARTBEAT)).unwrap(); with widget.handle()) like in cairo_shadow_button. But it don't work now in flpicture with browser.

@MoAlyousef
Copy link
Collaborator

If you can create a minimal repro of the code not working it might help with finding out what issue it has. It could be a bug in FLTK.

@theavege
Copy link
Contributor Author

@MoAlyousef I make it.

@theavege
Copy link
Contributor Author

theavege commented Jun 3, 2024

@MoAlyousef Do you have any comments about MR? Will you accept?

@MoAlyousef
Copy link
Collaborator

The amount of changes is too large, and I'm busy these days. I'll review them when I have the time.

@MoAlyousef
Copy link
Collaborator

It seems flpicture wasn't updated and there's a bug when the browser is selected.
Also I'm not a fan of prefixing project/directory names with fl.
Also adding a model to each project will just add some burden to whoever reads the code. The code needs to be simple so already working code need not be modified for a new design pattern. For example, the cairo shadow button code is just to show how one can use cairo to create an FLTK widget. It's not meant to be a whole program with some architecture.
I'm also not a fan of app::handle_main as the primary way of handling events. As such it should not be emphasized in the demos repo. And as you've seen, it can cause issues when the event isn't propagated correctly.

@theavege
Copy link
Contributor Author

theavege commented Jun 8, 2024

What architectural solution do you prefer?

@MoAlyousef
Copy link
Collaborator

Some new demos are ok. The demos which attempt to show interoperation with other libraries especially on how to integrate them with FLTK (like cairo for example), should show the minimal amount of code to get something working. It should be imperative, since it shouldn't assume how other devs using or integrating this code have structured their code.

@theavege
Copy link
Contributor Author

theavege commented Jun 9, 2024

I understood. But, what architectural solution do you prefer?

@theavege
Copy link
Contributor Author

@MoAlyousef Please add handling for deactivated widgets.

@MoAlyousef MoAlyousef merged commit f0acc12 into fltk-rs:master Jul 11, 2024
3 checks passed
@MoAlyousef
Copy link
Collaborator

Done

@theavege theavege deleted the fix/flcalculator branch July 16, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants