Re: External References to Form Elements & Menu Shortcuts

  • From: "Donald Marang" <donald.marang@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 28 Mar 2010 09:59:20 -0400

Thanks for the short primer on globals in object land.  I understand most of 
the concepts, but my mind gets stuck in procedural thinking.  

I may not change QuickOCR, since I will probably be retireing that project and 
moving on.  

Don Marang


From: RicksPlace 
Sent: Sunday, March 28, 2010 6:41 AM
To: programmingblind@xxxxxxxxxxxxx 
Subject: Re: External References to Form Elements & Menu Shortcuts


Hi: Last thing here; I just read up on Modules in Vb.net. I never use them but 
they are suppose to compile down to what is basically a Static Class  
conceptually. So, your using Modules should be fine for any code or even 
variable definitions you want to share among your forms. If you like modules 
then just put the variables like the ones I used in my Globals.vb class, minus 
the Static keyword, in your modules and you won't have to worry about using a 
Globals Class or other Code Classes if I read the quick overview of VB.net 
modules correctly. The concept is the same except you do not have to use the 
Static keyword, I read no advantage to either method. So, use the one most 
comfortable to you. If I am wrong someone will let me know but you do not have 
to change all your code if you put Global Variables inside a module instead of 
a Class as I read it.
Rick USA
  ----- Original Message ----- 
  From: Donald Marang 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Saturday, March 27, 2010 10:07 PM
  Subject: Re: External References to Form Elements & Menu Shortcuts


  I am not sure about conventional naming standards for forms in object 
oriented land.  This is a Windows Forms Application.  I had named the main 
window, which is a class I believe.  So my main window, named "dcQuickOCRForm" 
(the 'd' is for Dialog and the 'c' is for Control).  the last part "Tecxt" is 
the property that contains the text of the TextBox Control, " tcFilename" ('t' 
is for Textbox and 'c' is again for Control), to type in and display the 
filename.  My issue is that I now pulled code out of the main code file for the 
dcQuickOCRForm.vb file.  I now have this code in different subroutines (Sub) in 
separate module files.  I currently need to provide all three components.  I 
think what I want to do is place a "Using dcQuickOCR" statement within the 
module file.  Is this the correct way to do this in VB?  Does it require an 
"End Using" statement?  Is VB different than other languages in this respect?  
It just seems like it would be faster and less cumbersome as well as less 
confusing than identifying each level each time.  Would this call go inside 
each Sub block in this file or once just after the Module declaration at the 
very top?  

  This is a reference to an object property which contains the name of the 
image file on which to perform the OCR.  If performing OCR on a screen image 
from the clipboard, the program first writes the image to a temp TIFF file 
because I think the MODI object calls only work on a file.  

  For some reason, I did not provide a similar naming convention yet to menu 
components.  

  Don Marang


  From: RicksPlace 
  Sent: Saturday, March 27, 2010 8:22 PM
  To: programmingblind@xxxxxxxxxxxxx 
  Subject: Re: External References to Form Elements & Menu Shortcuts


  Hi: I don't get this file path. When I do code blocks I create them inside 
classes which I usually add to a project folder. Is this a file path or the 
name of something?
  dcQuickOCRForm.tcFilename.Text.
  You mentioned you have to put the above in a control, what type of control 
and are you binding to that control or what property of the control is the 
above path located in? 
  Just curious since I did not understand that part of the 
  message.
  Rick USA
    ----- Original Message ----- 
    From: Donald Marang 
    To: programmingblind@xxxxxxxxxxxxx 
    Sent: Saturday, March 27, 2010 9:15 AM
    Subject: External References to Form Elements & Menu Shortcuts


    Thanks everybody for the many tips!  My program has come a long way due to 
your help.  

    For now I think I will just distribute the executable, a Desktop Shortcut 
Icon, and some documentation files in a zip file.  The user would need to place 
the files at, "C:\QuickOCR" folder and copy the Desktop Shortcut Icon to the 
Desktop.  If they want to install elsewhere, they would need to change the path 
in the Desktop Shortcut Icon.  

    I have two small areas where I still have some questions.  

    I split out most of the large chunks of code, like the OCR processing, into 
subroutines in modules stored in separate files.  This works well, makes it 
easier to update, and would make it simple to add functionality in the future.  
One such addition would be adding other OCR Engines.  However, since it is not 
within the main form object code, I have had to supply the entire object 
heirachy in the references to controls, such as dcQuickOCRForm.tcFilename.Text. 
 I looked at the Imports, Namespace, and With Visual Basic commands.  I started 
playing around a little with these, but decided to first make the subroutines 
work.  Could someone enlighten me to which command would be appropriate, or 
what modifier on the main form object should be changed in this situation? 

    The other thing that started confuddling me at 2 AM last night was that 
JAWS refuses to announce the shortcuts in the menus.  I added the code to the 
File and Actions menus yesterday.  That was another reason I wanted most of the 
code, like "Perform OCR" as subroutines.  There are visible shortcuts in the 
menus and they work if you know the shortcut key combinations, like Control + O 
for Open image.  I have set the shortcut properties; 
ShortcutDisplayText="Ctrl+O", ShortcutKeys="Ctrl+O", and ShowShortcutKeys=True, 
of the menu items in the property tables for the menu items.  I have tried both 
"Ctrl+O" (contracted spelling) and "Control+O" (all characters) in the 
ShortcutDisplayText property.  Things are displayed on the screen as expected 
and function properly, but JAWS refuses to announce the shortcuts.  JAWS is 
announceing menu shortcuts in all other applications, including Visual Studio 
Express.  What do I need to do to force JAWS to recognize and announce the 
shortcuts?  

    Don Marang

Other related posts: