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

More Form Enhancements #138

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

literary-programmer
Copy link
Contributor

This commit enhances audio form with the ability to disable deletion of text as well as configure clipboard operations'.

  1. A new enum clipboard_flags: We now have a new enum that offers 3 constants: clipboard_flag_copy, clipboard_flag_cut_clipboard_paste. This is internal, and the users don't need to use this.

  2. 2 new methods for configuring whether or not you want to allow the users to use backspace or delete keys. a. bool audio_form::set_enable_delete(int control_index, bool enabled); b. bool audio_form::set_delete_disabled_message(int control_index, string mesage);

  3. A new method for setting clipboard_flags: bool audio_form::set_clipboard_flags(control_index, bool copy, bool cut, bool paste);

This commit enhances audio form with the ability to disable deletion of text as well as configure clipboard operations'.

1. A new enum `clipboard_flags`:
We now have a new enum that offers 3 constants: `clipboard_flag_copy, clipboard_flag_cut_clipboard_paste`. This is internal, and the users don't need to use this.

2. 2 new methods for configuring whether or not you want to allow the users to use backspace or delete keys.
a. `bool audio_form::set_enable_delete(int control_index, bool enabled);`
b. `bool audio_form::set_delete_disabled_message(int control_index, string mesage);`

3. A new method for setting clipboard_flags: `bool audio_form::set_clipboard_flags(control_index, bool copy, bool cut, bool paste);`
paste_text();
if (key_repeating(KEY_BACK)) {
if ((key_down(KEY_LCTRL) || key_down(KEY_RCTRL)) && (sel_start < 0 || sel_end < 0 || sel_start > sel_end)) {
if (false == enable_delete) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (false == enable_delete) {
if (!enable_delete) {

paste_text();
if (key_repeating(KEY_BACK)) {
if ((key_down(KEY_LCTRL) || key_down(KEY_RCTRL)) && (sel_start < 0 || sel_end < 0 || sel_start > sel_end)) {
if (false == enable_delete) {
speak(delete_disabled_message);
Copy link
Contributor

@harrymkt harrymkt Nov 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
speak(delete_disabled_message);
if (delete_disabled_message != "") speak(delete_disabled_message);

delete_word_left();
return;
}
delete_highlighted();
}
if (key_repeating(KEY_DELETE)) {
if ((key_down(KEY_LCTRL) || key_down(KEY_RCTRL)) && (sel_start < 0 || sel_end < 0 || sel_start > sel_end)) {
if (false == enable_delete) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (false == enable_delete) {
if (!enable_delete) {

delete_word_left();
return;
}
delete_highlighted();
}
if (key_repeating(KEY_DELETE)) {
if ((key_down(KEY_LCTRL) || key_down(KEY_RCTRL)) && (sel_start < 0 || sel_end < 0 || sel_start > sel_end)) {
if (false == enable_delete) {
speak(delete_disabled_message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
speak(delete_disabled_message);
if (delete_disabled_message != "") speak(delete_disabled_message);

THis commit adds a new method to the audio form. You can now set readonly attribute after creating a control.
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