Combo box

dlr at futurechalk.com dlr at futurechalk.com
Sun Nov 27 18:55:00 UTC 2022


Hello Wayne,

When I did this last I had to do key event processing. Here is a code snippet I used.

Dan Ridinger

# Does not process any thing when the list is dropped down to select.
#
# Break to end of switch
#
# P_KEY is the key that the user typed
# P_SYSTEM_KEY is the numeric value of a none alphanumeric key press
# P_EVENT is the event that was trapped
# P_OBJ_REF is the item reference for the object that keyevents is being trapped for.
# P_CASE_FLG flag to say whether to worry about case matching of input (default is false)
#
If #ALT|#CTRL ## Check if invalid  type of keystroke to process
Quit event handler (Pass to next handler)
End If
#
# Setup references for lookup and result list
#
Set reference L_LOOKUP_LIST_REF to $cinst.[P_OBJ_REF.$listname].$ref
Set reference L_RESULT_LIST_REF to $cinst.[mid(P_OBJ_REF.$dataname,1,pos('.',P_OBJ_REF.$dataname)-1)].$ref
Calculate L_LOOKUP_COL_NAME as mid(P_OBJ_REF.$calculation,pos('.',P_OBJ_REF.$calculation)+1,len(P_OBJ_REF.$calculation))
Calculate L_RESULT_COL_NAME as mid(P_OBJ_REF.$dataname,pos('.',P_OBJ_REF.$dataname)+1,len(P_OBJ_REF.$dataname))
Switch P_EVENT
Case evBefore
Do P_OBJ_REF.$redraw(kTrue,kTrue)
Calculate I_KEYSTROKES as ''
Quit method 
Case evClick
Calculate L_KEYSTROKE as L_LOOKUP_LIST_REF.[L_LOOKUP_COL_NAME]
End Switch
#
# Process the keystoke
#
# If not(P_OBJ_REF.$listdropped)
Do P_OBJ_REF.$redraw(kTrue,kTrue)
#
# Deal with a selection from the list for a value
#
If P_EVENT=evKey ## Key has been entered process
Do method Process Key Strokes (P_KEY,P_SYSTEM_KEY,L_KEYSTROKE) Returns L_KEYSTROKE
End If
#
# Build search criteria based on the Case Sensitivity flag
#
If P_CASE_FLG
Calculate L_SEARCH_CALC as con('mid(L_LOOKUP_LIST_REF.',L_LOOKUP_COL_NAME,',1,',len(L_KEYSTROKE),')=L_KEYSTROKE')
Else
Calculate L_SEARCH_CALC as con('upp(mid(L_LOOKUP_LIST_REF.',L_LOOKUP_COL_NAME,',1,',len(L_KEYSTROKE),'))=upp(L_KEYSTROKE)')
End If
#
# Strange behaviour with searching list. Must do operation twice to get the right searching result.
#
If len(L_KEYSTROKE)<>0
Calculate L_SELECTED_LINE as L_LOOKUP_LIST_REF.$search(1=0)
Calculate L_SELECTED_LINE as L_LOOKUP_LIST_REF.$search(evalf(L_SEARCH_CALC))
If L_SELECTED_LINE
Calculate L_LOOKUP_LIST_REF.$line as L_SELECTED_LINE
Else
Sound bell
Do method Process Key Strokes (pKey,kBack,L_KEYSTROKE) Returns L_KEYSTROKE
End If
Else
Calculate L_LOOKUP_LIST_REF.$line as 0
End If
#
# Set result list with the value found and set keystroke value
#
Calculate I_KEYSTROKES as L_KEYSTROKE
Calculate L_RESULT_LIST_REF.[L_RESULT_COL_NAME] as L_LOOKUP_LIST_REF.[L_LOOKUP_COL_NAME]
Do P_OBJ_REF.$redraw(kTrue,kTrue)
Calculate #S1 as P_OBJ_REF.$contents
#
# This disables the complete event processing to occur. If not present the matching value will not be displayed.
#
If P_EVENT=evKey
If P_KEY<>''
Quit event handler (Discard event)
End If
If not(#CTRL)&not(#RETURN)&not(#ENTER)&(P_SYSTEM_KEY<>27)
Quit event handler (Discard event)
End If
Quit event handler (Pass to next handler)
End If
# Else
# Breakpoint
# End If



> On Nov 27, 2022, at 10:26 AM, Wayne Germann <wgermann at PACIFIC.EDU> wrote:
> 
> Hello All,  
> 
> Does anyone know how to make a combo box drill down through its list as a user types in its field…like a droplist?
> 
> Sent from my iPhone
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list