cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
%3CLINGO-SUB%20id%3D%22lingo-sub-803092%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EJMP%20Application%20%3A%20access%20dynamic%20panel%20box%20child%20elements%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-803092%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3Ei%20am%20writing%20a%20app%20code%20which%20will%20dynamically%20create%20a%20textbox%20label%20and%20text%20edit%20box%20when%20user%20specifies%20how%20many%20is%20needed%20on%20button%20click%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EtextEditBoxList%20%3D%20%7B%7D%3B%20%20%2F%2F%20global%20variable%3CBR%20%2F%3ELoadSteps%20%3D%20function%20(%7BthisBox%7D%2C%20%7BDefault%20Local%7D%2C%0A%09steps_number%20%3D%20NumberEdit1%20%26lt%3B%26lt%3B%20Get%3B%20%20%20%2F%2F%20get%20number%20of%20items%20from%20number%20edit%20box%0A%09For(i%3D1%2C%20i%26lt%3B%3D%20steps_number%2Ci%2B%2B%2C%0A%09%09textBox%20%3D%20Text%20Box(%22Step%20%3A%20%22%20%7C%7C%20Char(i))%3B%0A%09%09textBox%20%26lt%3B%26lt%3B%20Set%20Width(100)%3B%0A%09%09%0A%09%09textEBox%20%3D%20Text%20Edit%20Box(%20%22Enter%20text%20here...%22)%3B%0A%09%09textEBox%20%26lt%3B%26lt%3B%20Set%20Width(300)%3B%0A%09%09%0A%09%09Insert%20Into(textEditBoxList%2CtextEBox)%3B%0A%09%09print(textEditBoxList)%3B%20%2F%2F%20Its%20always%20empty%0A%09%09%0A%09%09Panel1%20%26lt%3B%26lt%3B%20Append(%0A%09%09%09H%20List%20Box(%0A%09%09%09%09textBox%2C%0A%09%09%09%09textEBox%0A%09%09%09)%0A%09%09)%3B%0A%09)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3ENow%20on%20another%20button%20click%20i%20want%20to%20access%20the%20contents%20of%20textEBox%20of%20all%20child%20elements%20of%20panel%20box.%3C%2FP%3E%3CP%3Ei%20tried%20creating%20a%20global%20variable%20and%20accessing%20through%20it%20but%20dosent%20work.%20any%20alternative%20or%20better%20way%20to%20achieve%20this%20would%20be%20helpful.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-803092%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAutomation%20and%20Scripting%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-803132%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20JMP%20Application%20%3A%20access%20dynamic%20panel%20box%20child%20elements%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-803132%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EEither%20use%20XPath%20to%20get%20a%20list%20of%20references%20to%20a%20Text%20Edit%20Box%20(or%20text%20box)%20or%20utilize%20a%20list%20like%20you%20are%20doing%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0Anw%20%3D%20New%20Window(%22%22%2C%20%0A%09panel1%20%3D%20Lineup%20Box(N%20Col(2))%0A)%3B%0A%0Asteps_number%20%3D%203%3B%0AtextEditBoxList%20%3D%20%7B%7D%3B%0A%0AFor(i%20%3D%201%2C%20i%20%26lt%3B%3D%20steps_number%2C%20i%2B%2B%2C%0A%09textBox%20%3D%20Text%20Box(%22Step%20%3A%20%22%20%7C%7C%20Char(i))%3B%0A%09textBox%20%26lt%3B%26lt%3B%20Set%20Width(100)%3B%0A%09%0A%09textEBox%20%3D%20Text%20Edit%20Box(%22Enter%20text%20here...%22)%3B%0A%09textEBox%20%26lt%3B%26lt%3B%20Set%20Width(300)%3B%0A%09%0A%09Insert%20Into(textEditBoxList%2C%20textEBox)%3B%0A%09%0A%09Panel1%20%26lt%3B%26lt%3B%20Append(H%20List%20Box(textBox%2C%20textEBox))%3B%0A)%3B%0A%0Atebs%20%3D%20panel1%20%26lt%3B%26lt%3B%20XPath(%22%2F%2FTextEditBox%22)%3B%0A%0Ashow(tebs%2C%20textEditBoxList)%3B%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
ComplexNerd
Level III

JMP Application : access dynamic panel box child elements

Hi,

i am writing a app code which will dynamically create a textbox label and text edit box when user specifies how many is needed on button click

textEditBoxList = {};  // global variable
LoadSteps = function ({thisBox}, {Default Local}, steps_number = NumberEdit1 << Get; // get number of items from number edit box For(i=1, i<= steps_number,i++, textBox = Text Box("Step : " || Char(i)); textBox << Set Width(100); textEBox = Text Edit Box( "Enter text here..."); textEBox << Set Width(300); Insert Into(textEditBoxList,textEBox); print(textEditBoxList); // Its always empty Panel1 << Append( H List Box( textBox, textEBox ) ); ); );

Now on another button click i want to access the contents of textEBox of all child elements of panel box.

i tried creating a global variable and accessing through it but dosent work. any alternative or better way to achieve this would be helpful.

 

Thanks in advance

 

 

 

1 REPLY 1
jthi
Super User

Re: JMP Application : access dynamic panel box child elements

Either use XPath to get a list of references to a Text Edit Box (or text box) or utilize a list like you are doing

Names Default To Here(1);

nw = New Window("", 
	panel1 = Lineup Box(N Col(2))
);

steps_number = 3;
textEditBoxList = {};

For(i = 1, i <= steps_number, i++,
	textBox = Text Box("Step : " || Char(i));
	textBox << Set Width(100);
	
	textEBox = Text Edit Box("Enter text here...");
	textEBox << Set Width(300);
	
	Insert Into(textEditBoxList, textEBox);
	
	Panel1 << Append(H List Box(textBox, textEBox));
);

tebs = panel1 << XPath("//TextEditBox");

show(tebs, textEditBoxList);

-Jarmo