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

add form control. closes #532 #533

Merged
merged 9 commits into from
Feb 11, 2023
Merged

add form control. closes #532 #533

merged 9 commits into from
Feb 11, 2023

Conversation

JanMarvin
Copy link
Owner

@JanMarvin JanMarvin commented Feb 1, 2023

what does this PR provide

Initial work on form control objects (in addtion to Note the old style comments). This PR implements:

  • Checkbox to create checkboxes
  • Radio to create radio buttons
  • Drop to create drop down menus

open TODOs not handled in this PR

As of now (MS365 Feb. 2023) there are more form control elements possible, like Button, Label, GroupBox, ScrollBar and Spinner. For the time being they are not implemented. If they are needed, PR are welcome.

Currently formCntrlDrawing() contains a lot of similar XML code segments. This surely can be cleaned up and reduced into a cleaner and smaller function. PR are welcome.

The clientData() and clientDataFC() functions should be merged into a single function. PR are welcome.

There are some more options possible when tweaking form controls (e.g. like font style and size). PR are welcome.

examples

  wb <- wb_workbook()$
    # Checkbox
    add_worksheet()$
    add_form_control(dims = "B2")$
    add_form_control(dims = "B3", text = "A text")$
    add_data(dims = "A4", x = 0, colNames = FALSE)$
    add_form_control(dims = "B4", link = "A4")$
    add_data(dims = "A5", x = TRUE, colNames = FALSE)$
    add_form_control(dims = "B5", range = "'Sheet 1'!A5", link = "B5")$
    # Radio
    add_worksheet()$
    add_form_control(dims = "B2", type = "Radio")$
    add_form_control(dims = "B3", type = "Radio", text = "A text")$
    add_data(dims = "A4", x = 0, colNames = FALSE)$
    add_form_control(dims = "B4", type = "Radio", link = "A4")$
    add_data(dims = "A5", x = 1, colNames = FALSE)$
    add_form_control(dims = "B5", type = "Radio")$
    # Drop
    add_worksheet()$
    add_form_control(dims = "B2", type = "Drop")$
    add_form_control(dims = "B3", type = "Drop", text = "A text")$
    add_data(dims = "A4", x = 0, colNames = FALSE)$
    add_form_control(dims = "B4", type = "Drop", link = "A1", range = "D4:D15")$
    add_data(dims = "A5", x = 1, colNames = FALSE)$
    add_form_control(dims = "B5", type = "Drop", link = "'Sheet 3'!D1:D26", range = "A1")$
    add_data(dims = "D1", x = letters)

Screenshot 2023-02-01 at 22 07 23

Screenshot 2023-02-02 at 21 10 10

Screenshot 2023-02-04 at 15 17 22

@JanMarvin JanMarvin force-pushed the gh_issue_532 branch 2 times, most recently from f6165bb to a19ecec Compare February 6, 2023 20:01
@JanMarvin JanMarvin merged commit 393c2b3 into main Feb 11, 2023
@JanMarvin JanMarvin deleted the gh_issue_532 branch February 11, 2023 09:38
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.

None yet

1 participant