Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dialog as a VCX... gotta be a better way
Message
From
21/11/2003 09:40:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00852285
Message ID:
00852290
Views:
8
This message has been marked as a message which has helped to the initial question of the thread.
>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.

Thom,
With a show(1) you wouldn't need read/clear events. Hide() the form to continue on the line that follows read events. You'd get the value and release the for there.
PS: I didn't understand why "but if the dialog required more complexity, a class would be better" other than preference.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform