Main Site Documentation

Grid


#1

Ok so i have been playing around with adding images and being able to use touch commands, but at the moment I can only put the images in a column, im looking for a command I can use so I have a box, Or multiple column’s, instead of a single StackPanel the bit of code I have at the moment is:

Image image = new Image(Resources.GetBitmap(Resources.BitmapResources.weight));
Button imageButton = new Button(image);
Image image2 = new Image(Resources.GetBitmap(Resources.BitmapResources.list));
Button image2Button = new Button(image2);
// Button handler
imageButton.Click += new EventHandler(imageButton_Click);
image2Button.Click += new EventHandler(image2Button_Click);
// add button to the window
StackPanel stackPanel = new StackPanel();
stackPanel.Children.Add(imageButton);
stackPanel.Children.Add(image2Button);
mainWindow.Child = stackPanel;
stackPanel.SetMargin(0, 0, 0, 0);

there is more but I will spare you haha


#2

You can stack panel in a stack panel to make any layout you like


#3

Sorry for the super noob questions, but I’m learning! Ok I’m not fully understanding how to do it. I get what you mean, I’m just not sure how to implement it in the code. Here is the code I tried:

       StackPanel stackPanel = new StackPanel();
       stackPanel.Children.Add(imageButton);
       stackPanel.Children.Add(image2Button);
       StackPanel stackPanel2 = new StackPanel();
       stackPanel.Children.Add(stackPanel2);
       stackPanel2.Children.Add(image3Button);
       stackPanel.SetMargin(0, 0, 240, 0);
       stackPanel2.SetMargin(240, 0, 0, 0);
       mainWindow.Child = stackPanel;

What am I doing wrong?


#4

Looks like you have it right. What are you seeing?


#5

Only one panel will show up at a time, I’m a bit confused, so for the mainWindow, can it only have one child at a time, Because if i have two mainWindow.child = whatever; it will only show the last one, how can it have multiple children.


#6

Ok ok, i think I figured it out, I changed my code to :
Panel panel = new Panel();
panel.Children.Add(imageButton);
panel.Children.Add(image2Button);
panel.Children.Add(image3Button);
mainWindow.Child = panel;

and that solved it, Because that allowed me to specify exactly where I want the icons, But really quick question, with the chipworkx development system, The touch screen is pretty cool, but I have realized that its meant for a stylist, Is there any way it will accurately use just your fingertip, or maybe a different screen I could buy? I ask this because my intention is to build a board that will go in a tractor with farmers, and their not going to want to get their stylist out to hit the button, their going to want to just jab the screen. A screen that would work like an ipod touch screen.


#7

?


#8

Yes the touch is resistive so it needs stylus. If you want it more like an iPhone then you need to use capacitive touch screen. These are available but we do not offer them directly as of now


#9

Uhm, I can control my chipworkx with my finger? Working with cobra too? :-[

Or am I missing a point here? :stuck_out_tongue:


#10

Well using you’r finger works but its not accurate, like if I press on the right it will show up somewhere in the middle, but if you use your finger nail or something then it works great.


#11

Capacitive touch screen : Finger or something finger like only, resistive: anything will work
All GHI touchscreens are resistive.