10 Replies Latest reply on Oct 5, 2015 5:37 PM by danielafort

    Proper way to group rows of radio buttons?

    danielafort

      I'm trying to fix a menu problem on an open source plugin. The radio buttons were not put into groups so when one radio button is selected all the others disappear--though the selections are still saved.

       

      cr2hdr_Lightroom_plugin_GUI_before.jpg

      I grouped each row and that solved the selection issue but the appearance isn't right. Note that there is now a darker background on each row and the spacing has increased so the options no longer fit in the space.

      cr2hdr_Lightroom_plugin_GUI_after.jpg

      I looked through the code looking for something that might be setting the background but can't find anything. What should I be looking for?

        • 1. Re: Proper way to group rows of radio buttons?
          johnrellis Most Valuable Participant

          You might try something like:

           

          viewFactory:group_box {...background_color = LrColor ("white"), ...}

           

          Don't know if it will work, but there are many undocumented properties you can provide to controls.

          • 2. Re: Proper way to group rows of radio buttons?
            johnrellis Most Valuable Participant

            Also, instead of radio buttons, you could use a popup_menu(), which can be more space-efficient at providing multiple choices.

            • 3. Re: Proper way to group rows of radio buttons?
              danielafort Level 1

              johnrellis wrote:

               

              You might try something like:

               

              viewFactory:group_box {...background_color = LrColor ("white"), ...}

               

              Don't know if it will work, but there are many undocumented properties you can provide to controls.

               

              Where can I lookup these undocumented properties?

               

              I tried various ways to implement a background_color int the tab_view and group_box but it didn't change anything. Note in the screenshots there is a light gray color in the entire background. If I change tab_view to view the background changes to white, of course I can't do that because tab_view is needed. However, even with "view" the group_box has a gray background. Adding background_color = LrColor ("white"), doesn't change anything and I also haven't been able to change the vertical line spacing of the group_box so that the table fits in one page like it used to. Does it have to be a group_box? Can't it just be a group or group_row? (Of course that doesn't work.)

               

              I tried using popup_menu but that isn't desirable because we don't want to change the interface that radically.

               

              Is there something obvious that I'm missing? It seems like it should be a very simple fix--keep everything the same just group the radio buttons by rows instead of grouping all of the radio buttons on the page. The code for the menu is a bit much to post but here's the section of the code that seems to be causing the problem:

               

                  local sectionExec = {
                      title = LOC "$$$/ML/ExportManager/CRTitle=cr2hdr optional arguments",
                      synopsis = bind 'synopsis_cr2hdr',
                      visible = false,
                      f:tab_view {
                          value = "CRTab1",
                          fill_horizontal = 1,
                          f:tab_view_item {
                              title = LOC "$$$/ML/ExportManager/CRTab1=Arguments",
                              identifier = "CRTab1",
                              f:column {
                                  spacing = f:control_spacing(),
                                  fill_horizontal = 1,
                                  f:row {
                                      f:static_text {
                                          width = share 'labelExecWidth',
                                          title = LOC "$$$/ML/ExportManager/CRTab1Shortcuts=Shortcuts:",
                                          alignment = labelAlignment,
                                          size = labelSize,
                                      },
                                      f:checkbox {
                                          size = "small",
                                          tooltip = LOC "$$$/ML/ExportManager/TTFast=disable most postprocessing steps (fast, but low quality)\n(--mean23, --no-cs, --no-fullres, --no-alias-map, --no-stripe-fix, --no-bad-pix)",
                                          value = bind 'shortcut_fast',
                                          checked_value = true,
                                          unchecked_value = false,
                                      },
                                      f:static_text {
                                          text_color = ExecLabelColor,
                                          title = "fast",
                                      },
                                      f:spacer {
                                          height = spacerHeight,
                                      },
                                  },
              f:group_box {
                                  f:row {
                                      f:static_text {
                                          width = share 'labelExecWidth',
                                          title = LOC "$$$/ML/ExportManager/CRTab1IM=Interpolation methods",
                                          alignment = labelAlignment,
                                          size = labelSize,
                                      },
                                      f:radio_button {
              
              • 4. Re: Proper way to group rows of radio buttons?
                johnrellis Most Valuable Participant

                I don't have any more suggestions here.  It looks like the appearance of group_box() is hardwired. 

                 

                I searched the forums and my old email for "background_color", and it appears that it controls the background of presentFloatingDialog() when passed as a property of the "args" parameter (undocumented).  It is also documented to apply to scrolled_view().

                Where can I lookup these undocumented properties?

                This forum sometimes has some hints.  Also, Adobe hasn't been too careful about documenting the SDK in the last many years, so the description of individual controls is sometimes incomplete.  I look for properties that apply to other controls and just try them.  Also, we've discovered things by using the Debug Toolkit to dump out LrView objects and by using the Unix "strings" command on the LR executable and Adobe-supplied plugins.

                • 5. Re: Proper way to group rows of radio buttons?
                  danielafort Level 1

                  What seems strange to me is that the radio_button value is working properly but the UI doesn't show the radio button as being selected. Maybe that's a bug? The Windows users aren't reporting this issue. I don't have a Windows system to test this on so maybe it works fine on Windows? I'll see if I can get a Windows user to take a look at it and report back.

                  • 6. Re: Proper way to group rows of radio buttons?
                    johnrellis Most Valuable Participant

                    I don't completely understand the intricacies of radio buttons, but you do need to ensure that each set of buttons is in a separate container.  The SDK guide says:

                     

                    Within a container, only one of a set of radio buttons should be selected. Selecting one button should deselect all others in the set. You must enforce this in the way you bind the button values. It is not automatic.

                     

                    Further, the LR 6 SDK API reference says there is a difference between the behavior on Mac and Windows, which may account for the different behavior you're seeing:

                     

                    As of version 6.0 of the Lightroom SDK, on Mac only, radio buttons with the same parent view will be automatically 'linked', i.e. checking one will clear all the others, as a result of a change in the underlying OS provided API. This should only be noticeable in a view construct where radio buttons are declared via the osFactory:row or osFactory:column method within the same parent view. If you wish to have more than two radio buttons in a row or column, use the osFactory:view method instead, with a place attribute ofhorizontal or vertical. Do not attempt to take advantage of OS X's automatic behavior, as the automatically changed radio button states will not necessarily be reflected in the property table to which the radio buttons' values are bound.


                    This also suggests putting each set of radio buttons in an osFactory:view() container, with a "place" property.

                    • 7. Re: Proper way to group rows of radio buttons?
                      danielafort Level 1

                      I guess group_box works as a container but the hardwired appearance is sort of a bummer. Don't know if that counts as the "proper" way to group a row of radio buttons but it looks like we're running out of options to get this menu layout to look and work the same way on Mac and Windows. Are there any other "containers" that might work? I'm exploring popup_menu() -- does it support tooltips that the original developer spent so much time getting just right? Can't seem to find that in the documentation but it might be another undocumented feature?

                      • 8. Re: Proper way to group rows of radio buttons?
                        johnrellis Most Valuable Participant
                        Are there any other "containers" that might work?

                        See my previous message about using osFactory:view().

                        • 9. Re: Proper way to group rows of radio buttons?
                          johnrellis Most Valuable Participant
                          I'm exploring popup_menu() -- does it support tooltips

                          I don't think so.  I don't ever recall seeing a menu in any application whose individual items had tool tips. 

                          • 10. Re: Proper way to group rows of radio buttons?
                            danielafort Level 1

                            johnrellis wrote:

                             

                            See my previous message about using osFactory:view().

                             

                            Struggled with and gave up but thought I'd give it one more try and it worked. I was putting the "place" attribute in the wrong place. Doh!

                             

                            All that was needed was to replace:

                             

                            f:group_box {

                             

                            With:

                             

                            f:view { 
                                 place = horizontal,

                             

                            Genius--Thanks a bunch!