Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid & Memo and other problems...
Message
 
 
To
11/06/1999 11:54:01
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00227549
Message ID:
00228853
Views:
23
Hi Dragan,


>> How you define cColumnName?
>
>nColumnCount = this.columncount+1
>cColumnName="Column"+allt(str(nColumnCount))
>
>>defined in a .prg, so it has different defaults regarding the default control and its
>>
>> I am new here. I always created my classes visually, so could you give me a little more example here - how this prg should call, invoke, etc. I understand,
>>that I still can create this class visually, then copy code from ClassBrowser.
>>And am I right that I need to create class based on textbox, just in DblClick event and in KeyPress on Ctrl+Home have this code:
>
>There's this prgclasses.prg which I "Set Classlib to prgclasses.prg addi" in the addobject of the grid class which defines a column class called FColumn, and it goes something like this (I've omitted some confusing details):
>
>define class fcolumn as column
>	ColumnNumber=0
>Proc init
>Lpara pnColumnNumber
>	if empty(pnColumnNumber)
>		pnColumnNumber=this.parent.columncount+1
>	endif
>	this.removeobject("header1")
>	this.addobject("header1","fheader")
>	this.columnNumber=pnColumnNumber
>EndProc
>
>EndDefine
>
>Define class fheader as header
>
>procedure click
>* this grid is used in a form which always has a HeaderClick custom method:
>thisform.headerclick(this.parent.columnnumber)
>endproc
>
>enddefine
>
>
>You see, in this example the sole purpose of a custom column object is to equip it with a custom header instead of the standard header, so this header has some custom code defined on class level. Can't subclass columns and headers visually, so I did it this way.

Ok, thanks for this example, I will keep it in my mind for my future projects (I decided not to change the current project).

As I wrote in my previous message for you your advise about "N" or "Y" instead of "T" or "F" helped me and this part now works fine. Thanks again.


>>
>> MODIFY MEMO
>>
>> How can I decide when I need to put NOEDIT here - it depends on READONLY property of the parent object...
>
>So in the parent object's dblclick event you should have
>
>lcNoEdit=iif(this.readonly, "noedit", "")
>modify memo alias.memofield &lcNoEdit
>
>> Could you also suggest something about SetFocus problem?

>Can't remember the problem :). Like someone said, "my memory is one byte long". Aaaah... now I remember. Did you check what's thisform.activeobject.name? Put a breakpoint in the button's When event (or

Yes, I check. ThisForm.ActiveObject.Name return name of the object wich had focus before (I tried on the simple form, not on the page frame). I just put
=MessageBox(ThisForm.ActiveObject.Name)
dodefault() into when event of one of my buttons. Sometimes I saw this message and nothing happened then, sometimes click event fired and I didn't see this message.

just a Wait Window thisform.activeobject.name) and see if it's the button itself, or the previously active object. If it's the previous object, you can have a custom property (on the form, or in the button - but then you must design this button as a class, and add the property at the class level) which will keep the referrence to this LastActiveObject. If (and only if) it is the old object and not the button itself, you can
>
>* button.when
>thisform.LastActive=thisform.activecontrol

>
>* button.lostfocus
>
>thisform.LastActive.Setfocus
>nodefault

I think we need to use macro here like:

thisform.&LastActive..Setfocus
and this code should be in click event after dodefault()


>If this doesn't work, then your method of having each control report itself to the form when it receives focus (and do thisform.LastActive=this in its .gotfocus) should be the way to go. You should keep couple of things in mind:
>
>- release the referrence else the form won't close:
>* form.unload
>this.LastActive=.null.

>- the button itself should never report itself to the form as the LastActive, else you're back at square one
>
>Alternative solution would be to put the button on a toolbar - that way it never actually receives focus, so the focus remains on the control where it was.

Yes, I actually speak about our navstand class (navigations, set order, set filter, search, quit, etc.), so it could be a property of this class LastActive and on all (except quit, of course) buttons click event code we will write:

** some code
Local lcLastActive
lcLastActive=this.parent.LastActive
thisform.&lcLastActive..Setfocus

and for when event of all buttons:
this.parent.LastActive=thisform.ActiveControl.Name

But here is the potential problem - if our controls are not on the form, but on the page or another container object - how can we operate here?

Thanks
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform