Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FormSet address in a cursor
Message
From
21/07/2016 23:38:48
 
 
To
21/07/2016 23:10:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01638546
Message ID:
01638552
Views:
65
All of the VFP frameworks I've encountered include a Forms Manager which does these kinds of things. I haven't worked with CodeMine but IIRC you have used it. If it includes a Forms Manager you could get some ideas from that.

I believe this is one case where you'd need to use an array instead of a cursor. Array elements can contain object references.

Depending on your needs to might be able to make use of the built in .Forms array. This is available for the _SCREEN system variable and for formsets.

>Hello Al,
>
>English not being my native language I frequently realize that I didn't really explain myself well enough.
>
>So let me rephrase what I'd like to accomplish
>
>
>I could have many occurences of a given form being created/used any given time. I want the user to be able to specify which form should be visible at a given time. So only one is visible. the other ones would be invisible.
>
>So I thought that It would be doable to create a cursor.
>
>So first field of that cursor would be a string and second field of the cursor would contain a reference to the formset or form. That way the user would only see the strings related to the forms/formsets. When one of the strings is selected I would only have to make the good form/formset visible by using its reference.
>
>Perhaps I thought of a solution too complex for what I want to do.
>
>Now I'm guessing that managing by giving unique names to those forms/formset could be simpler.
>
>Any alternatives you want to suggest?
>
>
>>>I want to create a cursor that will contain values of forms or formsets.
>>>
>>>Example
>>>
>>>insert into addresses ('Name of formset1', ThisformSet)
>>>
>>>In that case the type of the field could be c(16)
>>>
>>>What would be the necessary field type for thisformset?
>>
>>Not sure what you're trying to achieve. AFAIK you can't directly store an object (or even just an object reference) in a cursor. But if you want to do what you're saying in the first line you could do something like this:
>>
>>CREATE CURSOR ValsCursor ( FSName C( 16 ), PropName C( 16 ), PropType C( 1 ), CharVal C( 100 ), IntVal I, NumVal N( 8, 2 ), LogVal L )
>>
>>INSERT INTO ValsCursor
>>  ( FSName ;
>>  , PropName ;
>>  , PropType ;
>>  , CharVal ) ;
>>  VALUES ;
>>    ( "MyFormSet" ;
>>    , "Name" ;
>>    , "C" ;
>>    , MyFormSet.Name )
>>
>>INSERT INTO ValsCursor
>>  ( FSName ;
>>  , PropName ;
>>  , PropType ;
>>  , IntVal ) ;
>>  VALUES ;
>>    ( "MyFormSet" ;
>>    , "FormCount" ;
>>    , "I" ;
>>    , MyFormSet.FormCount )
>>
>>INSERT INTO ValsCursor
>>  ( FSName ;
>>  , PropName ;
>>  , PropType ;
>>  , LogVal ) ;
>>  VALUES ;
>>    ( "MyFormSet" ;
>>    , "AutoRelease" ;
>>    , "L" ;
>>    , MyFormSet.AutoRelease )
>>
>>
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform