Rick,

    This is what I sent you and you will note the creation of just 2 different 
menu's but any number of dialogs can be done depending on what you need.
    For files and such just have one dialog that passes back or assigns to a 
global your results. Then all you do can be done.
    So I have placed her all the basic functions and routines. I start with the 
hotkey I had set for the Cuckoo clock. Don't know of any conflicts but probably 
there are.

    Read each step by step and get an understanding of the dialogs you need and 
assign each in this global section.
        Bruce


Sub CuckooClockEdit(myKeyId)
 'This routine is called when the hotkey Control-Insert-E is pressed.
 If Keyboard.KeyDescriberActive Then
  Speak myStrings(myKeyId & "_Description")
 Else
  'Main routine functionality goes here
'xxx
' This is the direct diablog to the option menu and not the help menu.
  Queue "LaunchMainDialog"

' Or the script help menu below, depending on what you want your hotkey to do.
'  ScriptHelp ' Script called when entering the help and options menu of the 
app manager.
  ' Test above by adding another dialog or menu and see what happens.
 End If
End Sub

' Create the menu's and dialogs you will need.
Dim myMenu : Set myMenu = Nothing
Dim myDialog: Set myDialog = Nothing

' This script support 7.1 and up only
If InStr(Version, "7.0") Then
 MsgBox myStrings( "Invalid_Version"), vbOkOnly + vbCritical, myStrings( 
"Script_Name")
 StopScript
End If

' Don't put ourselves into the Window-Eyes Scripts menu if the version of 
Window-Eyes is 7.0x.  We need at least 7.1 to do this.
If InStr(Version, "7.0") = 0 then
 Set myMenu = Menu(myXMLFile, "myScriptMenu", "MenuProc")
End If
' Above you just created the first menu you will see when going into the app. 
This will launch any dialog you want from that point on.

' then we also set up all the event processing you will want inside that first 
menu, including launching any other dialogs as stated above.
Function MenuProc(menuObj, id)
 MenuProc = False
 Select Case id
' Note that this first menu has liittle on it. so you have 2 choices, options 
or the help menu.
  Case "menu_options"
   Queue "LaunchMainDialog"
   MenuProc = True
   Exit Function
  Case "menu_help"
   If Not SO_StandardHelpDialog Is Nothing Then
    ScriptHelp
   End If
   MenuProc = True
   Exit Function
 End Select
End Function

' So you have selected one of 2 options above. One defined inside the help 
section and the other with the list of menu's and dialogs.
' below is the only dialog in this example and just some menu test points 
inside the case statements.

' First it is a routine that can be called from the first menu, launching the 
dialog box of your choosing from it.
' In this case it is my cuckoo Clock options menu.
Sub LaunchMainDialog()
' First we check to see if this dialog has already been created and not closed.
 If Not myDialog Is Nothing Then
'  This routine is for all fields to enable.
'  ResetDetailsAndComments myDialog
  RedrawMainDialog()
 Else
' Create the dialog if it does not exist.
 Set myDialog = Dialog(myXMLFile, "cuckooClockDialog", "MainDialogProc")
 End If
End Sub

' This is some testing samples inside the menu of this dialog. No different 
then any other event handler.
Function MainDialogProc(dObj, dEvent, dId, dControl)
 MainDialogProc = False
 Select Case dId
  Case "menu_file_reload"
   Speak " You pressed the reload button. ", speakerVoice
   Sleep 500
   MainDialogProc = True
   Exit Function
  Case "menu_file_exit"
   Speak " You pressed the close button. ", speakerVoice
   Sleep 500
   dObj.Close
   MainDialogProc = True
   Exit Function
  Case "menu_edit_something" 
   Speak " You pressed the something button. ", speakerVoice
   Sleep 500
   MainDialogProc = True
   Exit Function
  Case "menu_help_options"
' A flag for any other dialogs and such if already created.
'   IgnoreActivation = True
   ScriptHelp() ' Your original script help menu used inside the app man.
   MainDialogProc = True
   Exit Function
  Case "menu_view_refresh"
   Speak " You pressed the refresh button ", speakerVoice
   MainDialogProc = True
   Exit Function
  Case "menu_help_website"
' This will allow you to go to any web site of your choosing.
   If Not SO_LaunchUrl Is Nothing Then
    SO_LaunchUrl "http://www.gwmicro.com/sc";
    MainDialogProc = True
    Exit Function
   End If
  Case "btn_refresh"
   If dEvent = buttonClicked Then
' the first routine called is one that either enables or disables buttons and 
checkboxs, depending on what you want it to do.
    ResetDetailsAndComments dObj
    RefreshView dObj
    MainDialogProc = True
    Exit Function
   End If
  Case "btn_website"
   If dEvent = buttonClicked Then
' this calls the web site specified inside a list view or any text box of your 
choosing.
    If Not SO_LaunchUrl Is Nothing Then
     SO_LaunchUrl GetScriptProperty("notesurl", 
dObj.Control("tv_apps").Selected.Data)
    End If
    MainDialogProc = True
    Exit Function
   End If
  Case "btn_close"
   If dEvent = buttonClicked Then
' This button is the close button inside the file menu and will close your menu 
window.
    dObj.Close
    MainDialogProc = True
    Exit Function
   End If
  Case Else
' Below is what gets turned on when entering the dialog. 
' In other words, turn on your dialog window!
   If dEvent = dialogCreated Then
'    This routine is to init all buttons and fields.
'    InitEverything()
' Init any hotkeys you will need for your dialog.
'    Set myControlF = Keyboard.RegisterHotkey("Control-F", "LaunchFindDialog", 
dObj.Window, dObj)
    Set myDialog = dObj
    IgnoreActivation = True
' Now connect the watch event and save it inside it's own object name.
    dialogActivations = ConnectEventWithParameter(dObj.Window, "OnActivate", 
"OnActivate", dObj)
    MainDialogProc = True
    Exit Function
   ElseIf dEvent = dialogClosing Then
' Since we connected and may be closing, we know but the object we created from 
the watch event.
    If dialogActivations <> 0 Then
     IgnoreActivation = False
     Disconnect dialogActivations
     dialogActivations = 0
    End If
    ' This routine disables all fields.
'    ResetEverything()
    MainDialogProc = True
    Exit Function
   End If
 End Select
End Function

Sub OnActivate(wObj, dObj)
 If Not IgnoreActivation Then
  Queue "RefreshView", dObj
 End If
 IgnoreActivation = False
End Sub

Sub RefreshView(dObj)
'  Enable and focus any control inside the menu dialog.
End Sub

Sub ClickRefresh(dObj)
' do a refresh or go to a button that does a refresh and force a click.
 dObj.Control("btn_refresh").Click()
End Sub

Sub RedrawMainDialog()
' This will redraw your dialog window, restore it, and wait to make sure there 
is time for windows to complete the operation.
 If Not myDialog Is Nothing Then
  myDialog.Window.Redraw
  StartTimer 250, "SetFocus", myDialog.Control("tv_apps")
 End If
End Sub

Sub SetFocus(control)
' This is a short form of a focus, using just the control object.
 control.Focus()
End Sub

  ----- Original Message ----- 
  From: RicksPlace 
  To: [email protected] 
  Sent: Sunday, May 22, 2011 11:30 AM
  Subject: User Help Dialogs


  Hi: I want to have help dialogs for each page, form, a user might encounter. 
I also think it cool to allow users to modify the Help File if they have any 
personal notes or insights. To this end I could use a TextBox and add features 
like a typical Text Editor or save the files as .txt files and have them open 
in the user's default Text Editor. Do you have any comments on either method? 
  I have some code that allows some limited functionallity using a standard 
TextBox so would not have to do too much coding to turn it into something like 
I am thinking about and yet, a full Text Editor like NotePad has more features 
and is more familiar to most users.
  Later:
  P.S. This app is in VB.net and not a WE controlled Application so not in vbs 
and would not require the standard WE UI control set.
  Rick USA

Reply via email to