Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dialog as a VCX... gotta be a better way
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Dialog as a VCX... gotta be a better way
Miscellaneous
Thread ID:
00852285
Message ID:
00852285
Views:
35
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
Map
View

Click here to load this message in the networking platform