Choose Language Hide Translation Bar
Highlighted
lukasz
Level III

How to update separated values in a panel box?

Hello Everybody,

I want to update text edit boxes in a panel box. I tried to do that by using Set items (which should work for example for panel box) or but that seems to work if one have list box and not separated values from the list or values to be displayed located in different locations in a panel box. I would appreciate for hints how to solve that issue. Best regards.

 

//example values that will be updated each time when certain process is selected from the list (not shown here)
param1 = 1;
param2 = 2;
param3 = 3;
param4 = 4;

data_to_display = evallist({param1, param2, param3, param4}); //list of values to be displayed

infos = Panel Box("Module Infos",
				V List Box(			
					H List Box(				
						V List Box(					
							Text Box( "Param1:" ), 
							Spacer Box(Size(10, 6)),
							Text Box( "Param2:" ), 
						),
						Spacer Box(Size(15, 5)),
						V List Box(					
							Text Edit Box( Char( data_to_display[1] ), << Set Width( 130 ) ),
							Spacer Box(Size(10, 3)), 
							Text Edit Box( Char( data_to_display[2] ), << Set Width( 130 ) ),
						),
						Spacer Box(Size(40, 5)),
						V List Box(					
							Text Box( "Param3:" ), 
							Spacer Box(Size(10, 6)),
							Text Box( "Param4:" ), 
						),				
						Spacer Box(Size(15, 5)),
						V List Box(					
							Text Edit Box( Char( data_to_display[3] ), << Set Width( 100 ) ),
							Spacer Box(Size(10, 3)),
							Text Edit Box( Char( data_to_display[4] ), << Set Width( 100 ) ), 
						),					
					),
				),
			), 			                                      	
        ), 
        
        infos << Set items( data_to_display ); 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
lukasz
Level III

Re: How to update separated values in a panel box?

Thank you for replies. I manage to update the text edit boxes. In my case, text to be displayed depends on what has been previously selected in a list box, and because I wanted to have empty text boxes at the start of the application I shifted the update of text box variables before panel box where text edit boxes are located and just after option from list box is selected. And I got the desired effect. Best regards

new window("example",
H List Box(
	Panel Box("Params",
		params = List Box(
			unique_param_list,
			max selected( 1 ),
			//todo..
			
			//and then update of variables
			t1 << set text(var1);
			t2 << set text(var2);
			t3 << set text(var3);
			t4 << set text(var4);
		),
	),
	Panel Box("Module Infos",
		V List Box(			
			H List Box(				
				V List Box(					
					Text Box( "Param1:" ), 
					Spacer Box(Size(10, 6)),
					Text Box( "Param2:" ), 
				),
				Spacer Box(Size(15, 5)),
				V List Box(					
					t1 = Text Edit Box( " ", << Set Width( 130 ) ),
					Spacer Box(Size(10, 3)), 
					t2 = Text Edit Box( " ", << Set Width( 130 ) ),
				),
				Spacer Box(Size(40, 5)),
				V List Box(					
					Text Box( "Param3:" ), 
					Spacer Box(Size(10, 6)),
					Text Box( "Param4:" ), 
				),				
				Spacer Box(Size(15, 5)),
				V List Box(					
					t3 = Text Edit Box( " ", << Set Width( 100 ) ),
					Spacer Box(Size(10, 3)),
					t4 = Text Edit Box( " ", << Set Width( 100 ) ), 
				),					
			),
		),
	), 			                                      	
); 

 

View solution in original post

3 REPLIES 3
Highlighted

Re: How to update separated values in a panel box?

Messages go up the chain, not down. The message to the object referenced with infos is lost. You need to save the reference returned by the function called to create the text boxes and then use the variable to send the Set() message directly to that box.

tb1 = Text Box( "Param1:" )

tb1 << Set( ... );
Learn it once, use it forever!
Highlighted
pmroz
Super User

Re: How to update separated values in a panel box?

Panel boxes only contain other objects.  You can set the title of the panel box but that's about it.  The scripting index is great for finding out what methods work on what display objects.

Highlighted
lukasz
Level III

Re: How to update separated values in a panel box?

Thank you for replies. I manage to update the text edit boxes. In my case, text to be displayed depends on what has been previously selected in a list box, and because I wanted to have empty text boxes at the start of the application I shifted the update of text box variables before panel box where text edit boxes are located and just after option from list box is selected. And I got the desired effect. Best regards

new window("example",
H List Box(
	Panel Box("Params",
		params = List Box(
			unique_param_list,
			max selected( 1 ),
			//todo..
			
			//and then update of variables
			t1 << set text(var1);
			t2 << set text(var2);
			t3 << set text(var3);
			t4 << set text(var4);
		),
	),
	Panel Box("Module Infos",
		V List Box(			
			H List Box(				
				V List Box(					
					Text Box( "Param1:" ), 
					Spacer Box(Size(10, 6)),
					Text Box( "Param2:" ), 
				),
				Spacer Box(Size(15, 5)),
				V List Box(					
					t1 = Text Edit Box( " ", << Set Width( 130 ) ),
					Spacer Box(Size(10, 3)), 
					t2 = Text Edit Box( " ", << Set Width( 130 ) ),
				),
				Spacer Box(Size(40, 5)),
				V List Box(					
					Text Box( "Param3:" ), 
					Spacer Box(Size(10, 6)),
					Text Box( "Param4:" ), 
				),				
				Spacer Box(Size(15, 5)),
				V List Box(					
					t3 = Text Edit Box( " ", << Set Width( 100 ) ),
					Spacer Box(Size(10, 3)),
					t4 = Text Edit Box( " ", << Set Width( 100 ) ), 
				),					
			),
		),
	), 			                                      	
); 

 

View solution in original post

Article Labels

    There are no labels assigned to this post.