Expand my Community achievements bar.

Accelerator Key

Avatar

Former Community Member
I would like to create a shortcut key, such as Ctrl+space or Ctrl+z, that users can press when they get to a field which has a drop down list to display the list without having to use their mouse and click on the down arrow. The lists are either displayed from a Choice List or run a sql query to a database.



I looked at using an Accelerator key but cannot get that to work.



Is what I want to do possible? Any ideas on how I can accomplish it?



Thanks in advance.

Mary
2 Replies

Avatar

Former Community Member
Mary,



I would assume you are referring to the functionality within the Adobe Form Designer 5.0 or earlier? It may depend on what object you are trying to use the Accelerator property for. I tried it for both listbox and field objects and it seemed to fire the Click() just fine. However for a dropdown, it did bring focus to the object but failed to fire its Click().



Not sure of the 'big picture' here but why not fire your db lookup or DropOnEnter=True property within the OnEnter() for the dropdown object? This would alleviate the EU from having to use the mouse.



Just a thought...



-Jon-

Avatar

Former Community Member
Yes we are using Form Designer 5.0. The objects I'm using are Drop Down List Boxes.



I didn't know about the DropOnEnter=True property (I'm kind of new at this) but that works well if I have a Choice List typed under List in the properties of the object, but if I run a query in code it doesn't work. If, in the properties, I change the DropOnEnter=True I need to also change the DropDownStyle to DropDownList (according to something I read). If I do that, it works perfect when I have a choice list but the drop down list won't even display with a mouse click for the db query. If I have the DropDownStyle set to DropDown Combo, the list will display from the query when I enter the field, but when I leave the field after pressing Enter to select one item, the data disappears.



I have tried playing with different settings under Properties as well as looking at the code under the onExit and DropDownClick events for the object but am not sure.



Here is the code under the two events which might give you some insight. I tried playing with the defaultselection and currentselection but as of yet haven't gotten it to work.



It would be great if it worked just like it does with the Choice List.



OnDropDownClick

Dim oRS

Dim strList

Dim szSQL



psrelcode.Clear()



If (psrelcode.ListCount = 0) then

if rbbus.Value = rbbus.OnValue then

szSQL = "Select reldesc,relcode from relate where relcode = 'ADV' OR relcode = 'AKA' OR relcode = 'SUB' OR relcode = 'PAR' OR relcode = 'FKA' order by reldesc"

Set oRS = WFDataClient.ConvertToRecordset(WFDataClient.ExecuteReturnDataSetWithConnName(szSQL,"conn_son2"))

else

rbindiv.Value = rbindiv.OnValue

szSQL = "Select reldesc,relcode from relate where relcode = 'ADV' OR relcode = 'OC' OR relcode = 'PTR' OR relcode = 'PADV' OR "_

& "relcode = 'SP' OR relcode = 'EXPW' OR relcode = 'FKA' OR relcode = 'HEIR' OR relcode = 'TRUST' OR relcode = 'COOWN' OR "_

& "relcode = 'DIR' OR relcode = 'PRINC' OR relcode = 'CODEF' OR relcode = 'COCSL' order by reldesc"

Set oRS = WFDataClient.ConvertToRecordset(WFDataClient.ExecuteReturnDataSetWithConnName(szSQL,"conn_son2"))

End if



Do Until oRS.EOF

strList = strList & Trim(oRS(0)) & ";" & Trim(oRS(1)) & vbNewline

oRS.MoveNext

Loop



psrelcode.ChoiceList = strList

psrelcode.DefaultSelection = 0



End if



OnExit

Dim oRS

Dim strList

Dim szSQL



psrelcode.Clear()



form.BusyCursor = True



If (psrelcode.Text <> "") Then



szSQL = "Select reldesc,relcode from relate where reldesc = '" & psrelcode.Text & "'"

Set oRS = WFDataClient.ConvertToRecordset(WFDataClient.ExecuteReturnDataSetWithConnName(szSQL,"conn_son2"))



If (oRS.recordCount > 0) then

if (oRS.RecordCount = 1) then

psrelcode.Text = Trim(oRS(0) & "")

ReCode.Text = Trim(oRS(1) & "")

psrelcode.DropDownStyle=1

else

psrelcode.Text=""

ReCode.Text = ""

end if

Else

psrelcode.Text = ""

ReCode.Text = ""

form.BusyCursor = False

msgbox "No records found matching your criteria. Please try again.",vbinformation,"Relationship Lookup"

form.GoToField(psrelcode)

End if

Else

psrelcode.Text=""

ReCode.Text = ""

End if



psrelcode.CurrentSelection = 0

form.BusyCursor = False



Thank you in advance.

Mary