Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Methods in formset's forms' controls in a .prg
Message
From
26/07/1998 17:00:45
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00121398
Message ID:
00121516
Views:
18
>I'm seeing a couple of possibilities here. Try not using formset but rather form. I have found it much easier to design a class visually and create custom properties and methods.

Seems to be that createobject()ing of a formset is a great PITA, if you want it to do anything that isn't defined in its class. I think I'll just copy the class definition and save it without formset. Though, I'll have to move all the things from the formset into the form, but then, hey, it's OOP - have to do that only once.

> You can then put in main, PUBLIC oSomeFormName = " ".
>Then when you launch the form in .prg:
>
>do form SomeFormName name oSomeFormName linked with whatever, whatever

This wouldn't be suitable in this case - I want to keep it small and simple.

>if messagebox("what?", nWinType, cWinText) = 6
> do something
>else
> or not
>endif

MessageBox is not applicable at all in my case - its buttons are always in English (since we're a small market here, there's no localized version of neither VFP nor Windows), and, besides, the available set of choices is completely wrong for most of the occasions. How do you get a message box to display "The date ../../.. seems to be wrong" with buttons captioned "I'ts OK as is", "Let me fix it"?

Instead, I've written a decent substitute for MessageBox - it takes the buttons' captions in its second parameter, and returns 1, 2, 3.. the ordinal number of the button clicked, which seems much more logical than the MessageBox()'s constants. And it returns 0 if closebox is clicked, or ESC pressed. In the above example, I simply call:

if 1=alert("The date "+dtoc(this.value)+" seems to be wrong", "I'ts OK as is;Let me fix it")
set notify on
return .t.
else
set notify off
return .f.
endif

Anyway, this isn't about messagebox type dialogs at all - it's where I ask two dates to be entered, or a name or so - little data entry dialogs, with controls usually bound to private vars.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform