Re: Fruit basket program in Visual Basic 10 with Layout by Code

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 25 Jun 2010 11:13:36 -0400


Layout by Code for .NET is now part of Homer.NET (HomerLbc.dll).

Jamal


On 6/25/2010 9:41 AM, Homme, James wrote:
Hi Jamal,
Is it better to use Homer.net or LBC?

Thanks.

Jim

Jim Homme,
Usability Services,
Phone: 412-544-1810. Skype: jim.homme
Internal recipients,  Read my accessibility blog. Discuss accessibility here. 
Accessibility Wiki: Breaking news and accessibility advice

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jamal Mazrui
Sent: Thursday, June 24, 2010 9:15 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Fruit basket program in Visual Basic 10 with Layout by Code

I forgot to mention that, when using EdSharp, first choose the Visual
Basic .NET compiler with Control+Shift+F5.  The current CompileCommand
setting for that compiler is not configured for use of Homer.NET.  Thus,
you then need to use the Configuration Options dialog, Alt+Shift+C, to
set that option to the string mentioned below.

You would then compile source code with Control+F5.  The cursor should
automatically be positioned on the line containing the first compilation
error, if any.  You can press Alt+Shift+F5 to review all compiler
output.  This assumes you have installed the .NET Framework 4.  If not,
you can do so with the GotNET installer, available at

http://EmpowermentZone.com/netsetup.exe

Jamal


On 6/24/2010 3:44 PM, Jamal Mazrui wrote:
 From the archive
http://EmpowermentZone.com/vblbc_fruit.zip

This fruit basket is written in Visual Basic 10 (which was released in
April, 2010). It uses the Homer.NET library, distributed with the Homer
application framework, HomerApp, available at
http://EmpowermentZone.com/appsetup.exe

or .zip for a manual install.

Five Homer.NET assemblies, matching Homer*.dll, need to be included in
the same directory as the executable, vblbc_fruit.exe. The batch file,
compile.bat, builds the executable using the Visual Basic command-line
compiler, vbc.exe, based on the source code, vblbc_fruit.vb.

A compiler response file, Homer.rsp, sets most compiler parameters. This
response file can also be used to compile VB programs within the EdSharp
editor, available at
http://EmpowermentZone.com/edsetup.exe

To do this, set the CompileCommand setting in the EdSharp Configuration
Options dialog to the following string:

vbc.exe @Homer.rsp "%Source%" 2>&1

The commented source code is also pasted below.

Jamal

' Fruit basket in Visual Basic 10 with Layout by Code
' Public domain by Jamal Mazrui
' June 24, 2010

' Require variables to be explicitly declared
Option Explicit On
' Require type casts to be explicitly done
Option Strict On

' Import namespaces
imports Homer
imports System
imports System.ComponentModel
imports System.Windows.Forms

' Declare a class named 'Dialog' that inherits from the class named
'LbcForm'
Class Dialog
Inherits LbcForm

' Define the main event handler for this form
public Sub OnEvent(sEvent As String, oSender As Object, oArgs As EventArgs)
' Get references to the TextBox and ListBox widgets of this form
Dim txt As TextBox = me.GetTextBox("Fruit")
Dim lst As ListBox = me.GetListBox("Basket")

' Declare other local variables used in this event handler routine
Dim iCount, iIndex As Integer
Dim sFruit, sWidgetName As String

' Test for an event by name
Select Case sEvent
Case "Closing"
If Lbc.DialogConfirm("Confirm", "Exit program?", "Y")<>  "Y" Then
CType(oArgs, CancelEventArgs).Cancel = True
Case "Click"
' Test for a widget by name
sWidgetName = Lbc.GetName(oSender)
Select Case sWidgetName
Case "Button_Add"
sFruit = txt.Text
If sFruit.Length = 0 Then
Lbc.DialogShow("Alert", "No fruit to add!")
Else
lst.Items.Add(sFruit)
iIndex = lst.Items.Count - 1
lst.SelectedIndex = iIndex
txt.Clear()
End If
Case "Button_Delete"
iIndex = lst.SelectedIndex
If iIndex = -1 Then
Lbc.DialogShow("Alert", "No fruit to delete!")
Else
lst.Items.RemoveAt(iIndex)
iCount = lst.Items.Count
If iCount = 0 Then Return
If iIndex = iCount Then iIndex -= 1
lst.SelectedIndex = iIndex
End If
End Select
End Select
End Sub ' OnEvent method

' Define entry point of the program
Shared Sub Main()

' Instantiate an object of the Dialog class
Dim dlg As Dialog = New Dialog()
End Sub ' Main method

' Define the constructor of the Dialog class
Sub New()
' Set the dialog title
me.Init("Fruit Basket")

' Add a 'Fruit' label and a TextBox
me.AddInputBox("Fruit")

' Add a default button named 'Add'
me.AcceptButton = me.AddButton("Add")

' Start a new band of widgets
me.AddBand()

' Add a 'Basket' label and a ListBox
me.AddPickBox("Basket")

' Add a button named 'Delete'
me.AddButton("Delete")

' Complete setup of the dialog and activate it
me.CompleteDialog()
End Sub ' New method
End Class ' Dialog 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


This e-mail and any attachments to it are confidential and are intended solely 
for use of the individual or entity to whom they are addressed.  If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it.  If you are not the intended recipient, you must not keep, use, 
disclose, copy or distribute this e-mail without the author's prior permission. 
 The views expressed in this e-mail message do not necessarily represent the 
views of Highmark Inc., its subsidiaries, or affiliates.
__________
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: