Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a unique ID to save the grid settings
Message
From
13/04/2002 05:47:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00643563
Message ID:
00644656
Views:
6
Doron,
You mean it's not .scx based ? If so yes sys(1271) would always be .f. Do you really need it ? You could set your forms to have unique names (maybe just same as what their scx name would be) and use that. You actually don't need to save formname then, just sys(1272) would have the all info needed.
oForm = createobject('myForm','Doron')
oForm.Show
read events

Define class myform as form
  Userid = 'default'
  Name = 'UniqueFormName'
  add object grdWithId as myGrid
  
  Procedure init
    Lparameters tcUserId
    This.UserId = iif(!empty(tcUserId), tcUserId, This.UserId)
    * with this.grdWithId
    *   .SetId()
    *   .Init && Init with particular setup
    * endwith
  Endproc
  procedure activate
  with this.grdWithId
   messagebox('Inited to :'+chr(13)+ chrtran(.FormAndHierarchy,',',chr(13)) )
   .SetId()
   messagebox('Current :'+chr(13)+ chrtran(.FormAndHierarchy,',',chr(13)) )
  endwith
  endproc
  procedure queryunload
  clear events
  endproc
Enddefine

Define class myGrid as Grid
  FormAndHierarchy=''
  Procedure Init
    * If empty(thisform.UserId) && Just init do not setup
    *    return
    * endif
    This.SetId()
    * This.SetUp()  && Setup for particular user
  Endproc
  procedure SetId
  This.FormAndHierarchy = thisform.UserId+','+thisform.Name+;
     ','+sys(1272,this)
  endproc
Enddefine
Cetin
>Hi Cetin,
>
>That would not work in a class if I instantiate the form I mean the SYS(1271), since the form does not exist.
>
>I thought maybe to pass an expression unique to each grid call, and use that with the UserID and SYS(1272,This) that really will provide a unique ID per each grid call. I am trying to figure out that. You may have 3 buttons calling each grid in the same form and for each one of them you need to produce a unique id. I thought maybe to sum up all columns width + the RecordSource+ Something<s>.
>
>Regards,
>
>Doron
>
>
>>Doron,
>>Maybe I didn't understand your question. A grid could query :
>>thisform.UserID+" "+SYS(1271,This)+" "+UPPER(SYS(1272,This))
>>too in its init or in any method. ie: It could do this in its own init :
>>
>>if thisform.UserId = ''
>> return .t.
>>endif
>>this.Id = thisform.UserID+" "+SYS(1271,This)+" "+UPPER(SYS(1272,This))
>>
>>*Form.init
>>*...
>>thisform....mygrid.init()
>>
>>Cetin
>>
>>>Hi Cetin,
>>>
>>>The class is there already so why would I save it as class. I need pass some unique id into this class as explaned below.
>>>
>>>Regards,
>>>
>>>Doron
>>>
>>>>>Hi All,
>>>>>
>>>>>What kind of expression would you pass into each grid as a unique ID. Like you can have 5 users using the same grid via the same button named Income or 5 users are using the same button named company all in the same form. Each call has its own grid saving. If the grid could be saved as a class then it has the same form and same grid name all the time.
>>>>>
>>>>>If it is a form I can use like:
>>>>>UserID+" "+SYS(1271,ThisForm)+" "+UPPER(SYS(1272,This.grdPickList))
>>>>>
>>>>>But that does not work for a class.
>>>>>
>>>>>Any idea is appreciated.
>>>>>
>>>>>Regards,
>>>>>
>>>>>Doron
>>>>
>>>>Doron,
>>>>A grid could be saved as a class (mygrid.saveasclass()). You could save it to UserId.VCX.
>>>>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