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)
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
This.SetId()
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