<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Incorrect alignment of checkboxes on the user interface in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/772472#M95283</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thank you both very much for your responses. They helped me a lot and allowed me to solve my problem.&lt;BR /&gt;Thank you very much. Have a great day.&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2024 07:57:40 GMT</pubDate>
    <dc:creator>EvaCo</dc:creator>
    <dc:date>2024-07-11T07:57:40Z</dc:date>
    <item>
      <title>Incorrect alignment of checkboxes on the user interface</title>
      <link>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/770241#M95128</link>
      <description>&lt;DIV class=""&gt;Hello,&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I am currently developing a user interface with text and corresponding checkboxes. My code is :&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;strGroupColName = "Group";
lstGroupId = {"A", "B","C","D","E","F","G","H","I","J","K","L"};
strCompareControl = "Compare";
strCompareAddButton = "Add";
strCompareRemoveButton = "Remove";

Compare_String_Col_Box = function({strGroupColName,lstGroupId},

    //Get number of groups
    intNGpId    =     NItems(lstGroupId);

	strStringColBox = 
	"VListBox(
		BorderBox( Bottom(3),
			TextBox(strGroupColName),
		)";
		
	For(ig = 1, ig&amp;lt;= intNGpId, ig++,
		strStringColBox = strStringColBox || ",
		BorderBox( Bottom(3),
			TextBox(\!" " || lstGroupId[ig] || "\!",&amp;lt;&amp;lt;Justify Text( \!"left\!" ),&amp;lt;&amp;lt;Set Wrap(4000 )),
		)";
	);
	strStringColBox = strStringColBox || ")";

	return( eval( parse(strStringColBox) ) );
);

//Run display box containing comparison groups for user interface
winGroupComparison = function({lstGroupId},     
            //Get number of groups
            intNGpId    =     NItems(lstGroupId);

			//Construct string of String Col Box() containing border box to align labels with checkboxes
			strStringColBox = 
			"VListBox(
				BorderBox( Bottom(2),
					TextBox(strGroupColName),
				)";
				
			For(ig = 1, ig&amp;lt;= intNGpId, ig++,
				strStringColBox = strStringColBox || ",
				BorderBox( Bottom(2),
					TextBox(\!" " || lstGroupId[ig] || "\!",&amp;lt;&amp;lt;Justify Text( \!"left\!" ),&amp;lt;&amp;lt;Set Wrap(4000 )),
				)";
			);
			strStringColBox = strStringColBox || ")";
            
            //Construct string of 2 columns (Grp and Ctrl) of check boxes
            strNCheckBox      =     ConcatItems(repeat(list("CheckBox({\!"\!"})"),intNGpId),",");
            strCheckBx        =     "HListBox(  VListBox(TextBox(\!"Grp\!"), "||strNCheckBox||"),
                                                            VListBox(TextBox(\!"Ctrl\!"),"||strNCheckBox||"))";                                       
                                                                                                
            //Initialize to empty list of added comparison columns of check boxes
            lstcomparedpbx = list();
            
            //Script of display box containing all the check boxes and add and remove comparison buttons
            win = "BorderBox(Left(0),Top(20),
                        VListBox(
                        OutlineBox(strCompareControl,
                        HListBox(
                        bbxAdd = ButtonBox(strCompareAddButton,
                                          If(NItems(lstcomparedpbx)==0, lastcompbx = comparedpbx_5, lastcompbx = lstcomparedpbx[NItems(lstcomparedpbx)]);
                                          lastcompbx &amp;lt;&amp;lt; SibAppend(BorderBox(Left(10),HListBox(comparedpbx_i = "||strCheckBx||")));
                                          insertinto(lstcomparedpbx,comparedpbx_i);                                                                                                 
                                    ),
                        bbxRemove = ButtonBox(strCompareRemoveButton,
                                          Try(lstcomparedpbx[nitems(lstcomparedpbx)] &amp;lt;&amp;lt; delete) ;
                                          lstcomparedpbx = remove(lstcomparedpbx,nitems(lstcomparedpbx));
                                    ))
                        ,
                        BorderBox(Top(20),
                              HListBox(
                                    strcolbx = VListBox(
									Compare_String_Col_Box(strGroupColName,lstGroupId)),
                                    BorderBox(Left(10), HListBox(comparedpbx_1 = "||strCheckBx||")),
                                    BorderBox(Left(10), HListBox(comparedpbx_2 = "||strCheckBx||")),
                                    BorderBox(Left(10), HListBox(comparedpbx_3 = "||strCheckBx||")),
                                    BorderBox(Left(10), HListBox(comparedpbx_4 = "||strCheckBx||")),
                                    BorderBox(Left(10), HListBox(comparedpbx_5 = "||strCheckBx||")),
                        ))
                  )))";
                  
            return( win );
);//end function


groupwin = winGroupComparison(lstGroupId);

Newwindow("Test", eval( parse( groupwin )));

&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;The problem is that the checkboxes are not aligned with the corresponding text, and this issue occurs only on certain computers (same version of JMP used on these different computers). I believe this is due to the different screen sizes. For exemple :&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EvaCo_0-1720103409374.png" style="width: 281px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65868i485D95568A2A48D4/image-dimensions/281x440?v=v2" width="281" height="440" role="button" title="EvaCo_0-1720103409374.png" alt="EvaCo_0-1720103409374.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EvaCo_1-1720103409375.png" style="width: 280px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/65869iE5A52A91227BF58C/image-dimensions/280x438?v=v2" width="280" height="438" role="button" title="EvaCo_1-1720103409375.png" alt="EvaCo_1-1720103409375.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;How can I ensure that the checkboxes are always aligned with the text, regardless of the computer being used?&lt;/DIV&gt;&lt;DIV class=""&gt;I use JMP 17.2.0&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Thank you in advance for your help.&lt;/DIV&gt;</description>
      <pubDate>Thu, 04 Jul 2024 14:38:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/770241#M95128</guid>
      <dc:creator>EvaCo</dc:creator>
      <dc:date>2024-07-04T14:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect alignment of checkboxes on the user interface</title>
      <link>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/770251#M95129</link>
      <description>&lt;P&gt;I think easiest options might be to build your UI with H List Boxes instead of V List Box or by using Table Box / Lineup box.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With H List Box you can use Align("center"), with Table Box they should be aligned and same with Lineup Box. With Lineup Box you might want to use Lineup Ruler Box to modify the widths of each column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

strGroupColName = "Group";
lstGroupId = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"};

nw = New Window("",
	Lineup Ruler Box(
		Widths({50, 25,30,25,30,25,30,25,30,25,30,25,30}),
		lub = Lineup Box(N Col(11),
			Text Box("Group"),
			Text Box("Grp"),
			Text Box("Ctrl"),
			Text Box("Grp"),
			Text Box("Ctrl"),
			Text Box("Grp"),
			Text Box("Ctrl"),
			Text Box("Grp"),
			Text Box("Ctrl"),
			Text Box("Grp"),
			Text Box("Ctrl")
		);
	);
);

For Each({groupid}, lstGroupId,
	lub &amp;lt;&amp;lt; Append(Text Box(groupid));
	For(i = 1, i &amp;lt;= 10, i++,
		lub &amp;lt;&amp;lt; Append(Check Box(""))
	);
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 14:47:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/770251#M95129</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-07-04T14:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect alignment of checkboxes on the user interface</title>
      <link>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/770357#M95144</link>
      <description>&lt;P&gt;Hello, thank you for your feedback. Indeed, I have already considered using this "inline" structure, and I have reused your code to integrate the add and remove buttons.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;strGroupColName = "Group";
lstGroupId = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"};
Ncol = 11;

// Function to generate widths
GenerateWidths = Function({n},
    widths = {50};
    For(i = 2, i &amp;lt;= n, i++,
        Insert Into(widths, 25);
    );
    Return(widths);
);

// Function to recreate the Lineup Box
RecreateLineupBox = Function({},
    lineupBox = Lineup Box(N Col(Ncol));
    lineupBox &amp;lt;&amp;lt; Append(Text Box("Group"));
    For(j = 1, j &amp;lt;= (Ncol - 1) / 2, j++,
        lineupBox &amp;lt;&amp;lt; Append(Text Box("Grp"));
        lineupBox &amp;lt;&amp;lt; Append(Text Box("Ctrl"));
    );
    For Each({groupid}, lstGroupId,
        lineupBox &amp;lt;&amp;lt; Append(Text Box(groupid));
        For(i = 1, i &amp;lt;= Ncol - 1, i++,
            lineupBox &amp;lt;&amp;lt; Append(Check Box(""));
        );
    );
    Return(lineupBox);
);

// Function to update the main container with new contents
UpdateContainer = Function({container},
    lineupBox &amp;lt;&amp;lt; Delete; // Delete the existing Lineup Box
    lub = RecreateLineupBox();
    container &amp;lt;&amp;lt; Append(
        Lineup Ruler Box(
            Widths(GenerateWidths(Ncol)), // Adjust widths based on new Ncol
            lub
        )
    );
);

// Function to add a pair of Group and Control columns with checkboxes
AddGroupControlPair = Function({},
    Ncol = Ncol + 2;
    UpdateContainer(mainContainer);
);

// Function to remove the last pair of Group and Control columns with checkboxes
RemoveGroupControlPair = Function({},
    If(Ncol &amp;gt; 11,
        Ncol = Ncol - 2;
        UpdateContainer(mainContainer);
    );
);

// Initial window creation
nw = New Window("",
    mainContainer = V List Box(
        // Add and Remove Buttons
        H List Box(
            Button Box("Add", AddGroupControlPair),
            Button Box("Remove", RemoveGroupControlPair)
        ),
        lineupBox = Lineup Ruler Box(
            Widths(GenerateWidths(Ncol)),
            lub = RecreateLineupBox()
        )
    )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The drawback of this structure is that I find it difficult to imagine how to retrieve the content of my checkboxes "by column" as I used to do with &lt;CODE&gt;lstcomparedpbx&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 11:48:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/770357#M95144</guid>
      <dc:creator>EvaCo</dc:creator>
      <dc:date>2024-07-05T11:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect alignment of checkboxes on the user interface</title>
      <link>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/772422#M95272</link>
      <description>&lt;P&gt;These lines will provide you with a matrix of 1's and 0's to indicate the status of each check box in your array layout based on position.&amp;nbsp; Does this get you what you need?&amp;nbsp; To check, run your latest script, make some selections as desired, then run these two lines.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cBoxes = nw &amp;lt;&amp;lt; XPath("//CheckBoxBox");
results = Shape(Matrix(cBoxes &amp;lt;&amp;lt; Get), NItems(cBoxes)/(NCol-1));
Show(results);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jasean_0-1720641963079.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66060i0EBF034BC9CAE41D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jasean_0-1720641963079.png" alt="Jasean_0-1720641963079.png" /&gt;&lt;/span&gt;&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jasean_1-1720641993370.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/66061i670026D586858554/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jasean_1-1720641993370.png" alt="Jasean_1-1720641993370.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 20:09:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/772422#M95272</guid>
      <dc:creator>Jasean</dc:creator>
      <dc:date>2024-07-10T20:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect alignment of checkboxes on the user interface</title>
      <link>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/772449#M95276</link>
      <description>&lt;P&gt;Like &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/1643"&gt;@Jasean&lt;/a&gt; already suggested, you can use XPath to get references to all of the CheckBoxBoxes and then send &amp;lt;&amp;lt; Get to that. You can then handle that in many different ways, below is other option&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

strGroupColName = "Group";
lstGroupId = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"};
colcount = 5;

nw = New Window("CheckBox UI",
	window:lvals = lstGroupId;
	window:colcount = colcount;
	window:cbs = {};
	Lineup Ruler Box(
		Widths({50,40,45,40,45,40,45,40,45,40,45}),
		lub = Lineup Box(N Col(11));
	);
);

// Add "Headers"
lub &amp;lt;&amp;lt; Append(Text Box("Group"));
For(i = 1, i &amp;lt;= colcount, i++,
	lub &amp;lt;&amp;lt; Append(Text Box(Eval Insert("Grp(^i^)")));
	lub &amp;lt;&amp;lt; Append(Text Box(Eval Insert("Ctrl(^i^)")));
);

// Add "Rows"
For Each({groupid, idx}, lstGroupId,
	lub &amp;lt;&amp;lt; Append(Text Box(Eval Insert("^groupid^(^idx^)")));
	For(i = 1, i &amp;lt;= colcount * 2, i++,
		lub &amp;lt;&amp;lt; Append(cb = Check Box(""));
	);	
);


// Add functions to check boxes
nw:cbs = nw &amp;lt;&amp;lt; XPath("//CheckBoxBox");
nw:cbs &amp;lt;&amp;lt; Set Function(function({this},					
	cb_idx = Contains(cbs, this);
	cb_zeroidx = cb_idx - 1; // easier to handle as 0-based
	
	cb_col = Mod(cb_zeroidx, window:colcount * 2) + 1; // + 1 to back to 1-based
	cb_row = Floor(cb_zeroidx / (window:colcount * 2)) + 1; // + 1 to back to 1-based
	cb_type = If(Mod(cb_col, 2), "Grp", "Ctrl");
	
	show(cb_idx, cb_col, cb_row, window:lvals[cb_row], cb_type);
	Write("\!N");
));

Write();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2024 03:54:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/772449#M95276</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-07-11T03:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect alignment of checkboxes on the user interface</title>
      <link>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/772472#M95283</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Thank you both very much for your responses. They helped me a lot and allowed me to solve my problem.&lt;BR /&gt;Thank you very much. Have a great day.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 07:57:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Incorrect-alignment-of-checkboxes-on-the-user-interface/m-p/772472#M95283</guid>
      <dc:creator>EvaCo</dc:creator>
      <dc:date>2024-07-11T07:57:40Z</dc:date>
    </item>
  </channel>
</rss>

