Re: Example of nested layout panels and dynamic form creation with .NET

  • From: "Ricks Place" <OFBGMail@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 11 Oct 2008 08:02:55 -0400

Not really. You can modify the html and code to run how you like. I never used widgits or whatever, just native VS Controls and some Java Script. If I have a bunch of links, complex Menu or TreeView controls to be maintained dynamically I found VS a decent tool to use. Some of their controls are not as accessible as I would like but they might address that, who knows? It would be easier I think to work in PHP and all that jazz but I wanted to learn to do things the Microsoft way to stay somewhat consistent without having to use allot of diverse third party controls and applications which may, or not, be accessible or even work with each other. OI have enough trouble remembering how to use CSS, VWD, Java Script, HTML - all the versions, VB, handle Session Problems, Sql Server DataBase complexities and other things I can't even think of just now. I want consistency as much as possible so I tend to stick with Microsoft which maintains some consistency among it's product lines.

Anyway, I guess it is just a matter of preference for me.
Rick USA
----- Original Message ----- From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, October 11, 2008 7:45 AM
Subject: Re: Example of nested layout panels and dynamic form creation with .NET


Well, if I need to do programs with a simple interface, I don't even need to use wxWidgets, because I can use Win32::GUI which is really very simple to use.

But if I need to create complex GUIS, then I think that VS.net should be good for doing that. I know that a simple interface is prefered by the blind, but unfortunately sometimes we need to do what the sighted folks like.

If we can create old-style menus and use layout managers by code in VS.net, then why not doing with TextPad? It would be running much faster than VS.net. :-)

Octavian

----- Original Message ----- From: "Ricks Place" <OFBGMail@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, October 11, 2008 1:55 PM
Subject: Re: Example of nested layout panels and dynamic form creation with .NET


I have used Visual Studio since 2005 and never used Intellisense, wish I know how. As for layout, it all depends on what you are doing. Everyone has their own work-arounds. I use windoweyes and have found work-arounds for menu items and it is much easier in jaws if I remember. You can code by hand if you like and I do that sometimes but use the designers for most things. I do not do nested table layouts for the most part just because I follow the KISS approach to design since I use a screen reader and simpler is usually better.
Rick USA
----- Original Message ----- From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, October 11, 2008 6:18 AM
Subject: Re: Example of nested layout panels and dynamic form creation with .NET


Ok, but this is exactly what I don't know how to do.

I don't know if it is possible for the blind to use the forms designer easier than creating the design manually. Jamal says that it is easier manually than using the forms designer, and until now I found it pretty hard to create the menus, and I don't even know if it is possible to create old-style menus using the forms designer.

I have found that it is pretty hard to use layout managers when using the forms designer. Can you use layout managers when using the forms designer? Can you tell us how to place a layout manager into another one and generally tips about using layout managers?

I also said that the intelisense is helpful, but I already said that I found that this is an exception, and without it, VS.net is pretty useless for the blind. I would be glad if this isn't true.

Octavian

----- Original Message ----- From: "James Panes" <jimpanes@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, October 11, 2008 11:54 AM
Subject: Re: Example of nested layout panels and dynamic form creation with .NET


Hi Teddy,

I had been out of the loop for several years when I started programming with Bill Dennis's Blind Geeks. The VS interface was like very easy to use. It helped me a lot especially when it came to intellesense and form layout.

How would you like to go back to "Edlin" and a paper manual?

Sorry if you don't like exactly what it does, but I will not agree that it
is useless.

.
Regards,
James
jimpanes@xxxxxxxxx
jimpanes@xxxxxxxxxxxx
"Everything is easy when you know how."

----- Original Message ----- From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Friday, October 10, 2008 4:55 PM
Subject: Re: Example of nested layout panels and dynamic form creation with
.NET


Aha, so I am not wrong when I say that actually, VS.net is pretty useless
for the blind?

Again, if we don't consider Intelisense, of course.

Octavian

----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Friday, October 10, 2008 11:26 PM
Subject: Example of nested layout panels and dynamic form creation with .NET


/*
Example of nested layout panels and dynamic form creation
Public domain by Jamal Mazrui
October 10, 2008

Here is an example of using nested layout panels of the .NET Framework.
Note that no pixel coordinates are used for positioning and sizing
controls. The form, TableLayoutPanel, FlowLayoutPanels, and Buttons are
all laid out  automatically according to defaults and need.

I wrote and compiled this C# code with EdSharp and the command-line
compiler.  Although Visual Studio certainly has its benefits, I think
significantly more time, effort, and code would probably be involved to do the same thing with the form designer, code generator, and multiple files
of a Visual Studio project.

Below is the source code of LayoutPanels.cs, which is also included with
the compiled version, LayoutPanels.exe in the archive available at
http://EmpowermentZone.com/LayoutPanels.zip

When the executable is run, it calls a function called MultiInput that I have found useful in various contexts. It presents a dialog with a number of edit boxes determined at runtime. Parameters to the function provide the dialog title as a string, and the labels and default values of each field in arrays. The function returns an array with values as edited by the user, or an empty array if the dialog is canceled. The program shows
those return values in a message box.
*/

using System;
using System.Collections.Generic;
using System.Windows.Forms;

class Program {
static void Main() {
string sTitle = "Example of Layout Panels";
string[] aLabels = {"Label1", "Label2", "Label3"};
string[] aValues = {"Value1", "Value2", "Value3"};

string[] aResults = MultiInput(sTitle, aLabels, aValues);
if (aResults.Length == 0) return;

MessageBox.Show(String.Join("\n", aResults), "Results");
Console.Write(String.Join("\n", aResults));
} // Main method

public static string[] MultiInput(string sTitle, string[] aLabels,
string[] aValues) {

/*
Define a dialog form containing a vertical FlowLayoutPanel, which in turn,
contains a TableLayoutPanel and a horizontal FlowLayoutPanel below it
After initializing each control, suspend automatic layout until all its
properties, and those of its child controls, have been set
The OK button captures the values entered or modified, which the function
returns in an array
*/

// Define the dialog form
Form frm = new Form();
frm.SuspendLayout();
frm.AutoSize = true;
frm.AutoSizeMode = AutoSizeMode.GrowAndShrink;
frm.AutoScroll = true;

// Define the main , vertical FlowLayoutPanel
FlowLayoutPanel flpMain = new FlowLayoutPanel();
flpMain.SuspendLayout();
flpMain.AutoSize = true;
flpMain.AutoSizeMode = AutoSizeMode.GrowAndShrink;
flpMain.FlowDirection = FlowDirection.TopDown;

/*
Define a TableLayoutPanel with two colums, the left containing field
labels and the right containing field values
The number of rows is the number of items in the array of field labels
passed to the function.
There will be one row for each field.
determined by the size*/

TableLayoutPanel tlpFields = new TableLayoutPanel();
tlpFields.SuspendLayout();
tlpFields.Anchor = AnchorStyles.None;
tlpFields.AutoSize = true;
tlpFields.AutoSizeMode = AutoSizeMode.GrowAndShrink;
tlpFields.ColumnCount = 2;

// Add a column style for each column
for (int i = 0; i < tlpFields.ColumnCount; i++) {
tlpFields.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
}

// Add a row and row style for each field
tlpFields.RowCount = aLabels.Length;
for (int i = 0; i < tlpFields.RowCount; i++) {
Label lbl = new Label();
lbl.AutoSize = true;
lbl.Text = aLabels[i] + ":";
TextBox txt = new TextBox();
txt.Text = aValues[i];
tlpFields.Controls.AddRange(new Control[] {lbl, txt});
tlpFields.RowStyles.Add(new RowStyle(SizeType.AutoSize));
}
tlpFields.ResumeLayout();

// Below the TableLayoutPanel of fields, add a horizontal FlowLayoutPanel
containing buttons
FlowLayoutPanel flpButtons = new FlowLayoutPanel();
flpButtons.SuspendLayout();
flpButtons.Anchor = AnchorStyles.None;
flpButtons.AutoSize = true;
flpButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink;
flpButtons.FlowDirection = FlowDirection.LeftToRight;

// Define the OK button
Button btnOK = new Button();
btnOK.Text = "OK";

// Define its event handler
List<string> listResults = new List<string>();
btnOK.Click += delegate(object o, EventArgs e) {
foreach (Control ctl in tlpFields.Controls) {
if (ctl.GetType() == typeof(TextBox)) listResults.Add(ctl.Text);
}
frm.Close();
};

// Define the Cancel button
Button btnCancel = new Button();
btnCancel.Text = "Cancel";
btnCancel.Click += delegate(object o, EventArgs e) {frm.Close();};

flpButtons.Controls.AddRange(new Control[] {btnOK, btnCancel});
flpButtons.ResumeLayout();

flpMain.Controls.AddRange(new Control[] {tlpFields, flpButtons});
flpMain.ResumeLayout();

// Set remaining properties of the form
frm.AcceptButton = btnOK;
frm.CancelButton = btnCancel;
frm.StartPosition = FormStartPosition.CenterParent;
frm.Text = sTitle;
frm.Controls.Add(flpMain);
frm.ResumeLayout();
frm.ShowDialog();
frm.Dispose();

return listResults.ToArray();
} // MultiInput method

} // Program class

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: