General information
Category:
Coding, syntax & commands
Title:
Dialog as a VCX... gotta be a better way
To all,
I'm trying to make what should be a very simple app: a dialog to display all the DSNs available for a given type of data source and return the user selected DSN. The app has a listbox (displaying the DSNs) in a form. I don't much care for SCXs so the form was saved as a VCX.
If I were using an SCX I could have done:
DO FORM MyForm WITH m.vcDbType TO m.lcDSN
but I don't want to go that way... it would work for this, but if the dialog required more complexity, a class would be better.
Anyway, to achieve the equivalent functionality as the simple DO FORM command, I had to write the following shell program for the dialog class:
LPARAMETER vcDbType
LOCAL loFrom, lcDSN
m.vcDBType = IIF(PARAMETERS() = 0, m.vcDbType, '')
loForm = NEWOBJECT("myForm", "myForm.vcx")
WITH loForm
.pcDbType = m.vcDbType
.Show()
READ EVENTS
.Set_RetVal() && determine which item in the listbox was selected
m.lcDSN = .pcRetVal
ENDWITH
RELEASE ALL LIKE lo*
RETURN(m.lcDSN)
Hell of a lot of work for a simple dialog, and that doesn't show the extra stuff in the listbox to CLEAR EVENTS on an ENTER or ESCAPE.
There's gotta be a better way.
TIA,
Thom C.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only