Hi Guys: Being able to trap a KeyUp or KeyDown or KeyPress event is a very, very good thing to be able to attach to any control or even a form, dialog, in general. For example, you might be able to add a KeyUp event to a TextBox or ListBox or TreeView and then assign f1 as a help key for that control or perhaps something like alt-f1 if f1 is taken up for general help. Same for mouse, you could set up a PopUp dialog that comes up when a control is right mouse clicked that has several optiions (Actions) to select from. Perhaps display properties for a control or display some details for a selected item or delete a selected item or whatever... This is how I do things in VB.net and how it works in the other major OOP languages of Visual Studio. Processing Keyboard events is a powerful tool in the right hands. I did not know it could be done in VBS and WE but knowing is half the battle!
Of the other half is having something to script that makes sense.
PS: My Translation app is pretty much done and has been for several weeks. I just haven't set it up to allow for a download within the WE environment since I have some questions about my future scripting activities using WE instead of some other option. Anyway, if anyone wants the app let me know and you can use, not publish, it if you want. That is because I use the free version of the MS license even though they sent me a nice contract to get more capabilities and allowable usage of their software. They were very nice about this and would have given me allot of access to their system for free but I just did not see the point in doing it since I may not be doing much, if any WE scripting going forward and if I do some other software scripting I would need a diferent license from MS. Anyway, let me know if you want the project, actually just the executable and the files unless you have either VS 2008 or VB.net 2008 and are pretty good with VB.net programming. I jusyt thought of the WETranslator App, I had even forgotten about it with everything going on in our family, when you mentioned the KeyUp event. I guess it just triggered my memory.
Well, that's all I have for now.
The ability to handle and assign events to controls in the DOM is a major power in the WE Scripting ToolBox.
Later:
Rick USA
----- Original Message ----- From: "BT" <[email protected]>
To: <[email protected]>
Sent: Friday, August 12, 2011 12:18 AM
Subject: Re: Tree view



Hi Again Chip,

   When reading your response a second time, I guess you are saying assign
a key that when it is hit it will look at the item on the list and assumes
that to be the selected one and act on it. Yes that would be a nice
approach, but would have to make one for the mouse as well. I guess both
have the same amount of work in them except your approach would eliminate
the event watch for keyup stuff.

   Now having said that, I actually did make one for the spacebar key. It
would also act inside the menu and had no way to shut it off there because
of the lack in events. In other words, hitting the alt key to get to the
menu or the mouse click on the menu, would make things worse to attempt to
shut off the tree view stuff for the spacebar, for all are inside the same
dialog and limited on treeview events, the blur function does not work when
hitting the alt key nor mouse button. the tree view blur only works when
leaving the dialog.

   so, I guess once again aI found it there was too much of a headache to
have a non-standard hotkey do what is already there. For I even got rid of
the checkbox by just doing what I did by just waiting for the key up and
which key did the up event. I just have to take out the number 32 ASCII code for the spacebar and use the built in code because that will cause problems
in other platforms.. that do not use ASCII standard coding.

so, I guess what you suggested I already did attempt to do and it caused too much of a headache to use. since the spacebar is used for selection and button pressing, that was the way to go and my approach the only one to use.
I am sure one with more experience then me may have thought of something I
have not, but with my knowledge of what is inside the object manual, this is
what I could only think of using and keeping things inside standard key
functions like the spacebar.

       Sincerely
       Bruce

Sent: Thursday, August 11, 2011 8:53 PM
Subject: RE: Tree view


Hi Bruce,

It seems like you want something to happen when there's a treeview focused
and the user pressed a key?  You could also define a hotkey then when the
treeview gets focus.  might be simpler ... don't know without having done
the work.

Chip


-----Original Message-----
From: BT [mailto:[email protected]]
Sent: Thursday, August 11, 2011 12:07 PM
To: [email protected]
Subject: Re: Tree view


For all new programmers,
Below is the final - finish of my project on tree view selections.

       Bruce

This is my dialog procedure for event capture and what I did using the tree
view option instead of buttons; reduced to only the tree view items.
Function MainDialogProc...
If dEvent = treeviewKeyDown Then
 Set TV_Obj = myDialog
 TV_KeyDown = True
 myTV_KeyConnection = ConnectEvent( Keyboard, "OnKeyProcessedUp",
"OnKeyProcessedUp")
End If
If dEvent = treeviewClicked Then
 Set TV_Obj = myDialog
 TV_MouseDown = True
 myTV_MouseConnection = ConnectEvent( Mouse, "OnButtonUp", "OnButtonUp")
End If If dEvent = treeviewSelectionChange Or dEvent = treeviewClicked Then
 TV_Name = dControl.Text
 TV_Data = dControl.selected.Data
  MainDialogProc = True
  Exit Function
End If
'... other event selections
'End of my  dialog proc
End Function

Sub OnKeyProcessedUp( ky, md)
Disconnect myTV_KeyConnection
myTV_KeyConnection = 0
If TV_KeyDown and ky = 32 and md = 0 Then
 Queue "TV_Options"
End If
TV_KeyDown = False
End Sub

Sub OnButtonUp( button)
Disconnect myTV_MouseConnection
myTV_MouseConnection = 0
If TV_MouseDown and button = 0 Then
 Queue "TV_Options"
End If
TV_MouseDown = False
End Sub

Sub TV_Options()
' Do Treeview Items.
Silence
Select Case TV_Data
 Case 0
' Speak " Navigate through tree then mouse click on or press space bar to
do selection. "
  promptArray(1) = myStrings( "treeview_info")
  promptArray(2) = " Cuckoo clock  Options "
  Queue "msgBoxOk"
 Case 1
  promptArray(1) = myStrings( "dialogbox_info")
  promptArray(2) = " Cuckoo clock Menu "
  Queue "msgBoxOk"
 Case 2
 Queue "DoAnnouncement"
 Case 3 ' dId = "btn_mainDialog_listen"
  Queue "SearchAndPlayWav", TV_Obj
 Case 4 ' dId = "btn_mainDialog_copy"
  Queue "SearchAndCopyWav", TV_Obj
 Case 5 ' dId = "btn_mainDialog_rename"
  Queue "SearchAndRenameWav", TV_Obj
 Case 6 ' dId = "btn_mainDialog_delete"
    Queue "SearchAnddeleteWav", TV_Obj
 Case 7
  If RecordEnabled Then
   Queue "RecordAndPlay", ""
  Else
   Speak " No Record Feature Enabled! ", speakerVoice
  End If
 Case 8 ' "btn_mainDialog_tts"
  editSearchType = myStrings( "Txt_Search_Type")
  editSearchExtension = myStrings( "Txt_Search_Ext")
  Queue "LaunchTtsDialog"
 Case 9 ' dId = "btn_mainDialog_playText"
  Queue "SearchAndPlayText", TV_Obj
 Case 10 ' "btn_mainDialog_time"
  Queue "DoTime"
End Select
End sub




Reply via email to