Re: Productivity



Pete Dashwood wrote:
I remember battling to get the standard directory/file selection dialog included in an OO COBOL (PowerCOBOL)application. It was difficult and non-intuitive. There was no documentation provided by Fujitsu and I had no idea what the component was even called or where it lived. I had to use an Object Browser to locate it amongst thousands of Operating System components, and then try and figure out what its methods, properties, events, and interfaces were and provide the correct format for them in COBOL. Finally got it working, but it took a day. In C#/DotNET I did the same job in literally 5 minutes, dragging the component from the toolbar directly into my codeview. And it displays in the Windows XP theme automatically, so the program does not look "alien" to the user. I actually wrote 9 lines of code to support this, and 6 of those are comments...:

Here's the C# code:

private void button1_Click(object sender, EventArgs e) //provided by VS2005
{ //provided by VS2005

/* User clicks "Browse for database" button. Open the standard dialog
* and put the selected file and path into the current form.
*
* This is only for MS ACCESS... other databases and ODBC have other selections.
*
*/

openFileDialog1.InitialDirectory = "C:\\"; // start at the beginning...
openFileDialog1.ShowDialog();
textBox1.Text = openFileDialog1.FileName;

} //provided by VS2005

How about this?

method-id. "button1_Click" final private.
linkage section.
01 sender object.
01 e System-EventArgs.
procedure division using by value sender e.

*> everything above here generated
move "C:\\"
to self::"openFileDialog1"::"InitialDirectory"
invoke self::"openFileDialog1"::"ShowDialog"()
move self::"openFileDialog1"::"FileName"
to self::"textBox1"::"Text"
*> everything below here generated

end method "button1_Click".

:-)

Frank



.


Quantcast