General information
Category:
Forms & Form designer
PMFJI-
>>1. when you say "every control's gotfocus sets a self reference to >>thisform.lastcontrol". i am saying whatever.lastcontrol = >>"whatever.txtlastname". is there a easier way to set a self reference than >>typing the name in for each control?
>In the base class of every control, put something like this in the gotfocus:
>THISFORM.LastControl = THIS
>This gives the form an object reference, and not just a control name. This is >why it is important to set the form property to .NULL. in the form.destroy, >because if there the form holds outstanding object references, it will not >release.
>>2. when the client clicks on toolbar.cmdsave, and i setfocus, yes the valid is >>fired, and the messagebox comes up if an error is found. but how can i in >>otoolbar.cmdsave know that? i do not want to continue with the save if an >>error was found. know i can set a global variable, but is there a better way?
>Whether the toolbar runs the valid, or a special form method runs the valid, you >can return .F. all the way back up to the toolbar button. So if you run the valid >directly, your tb button syntax would be like:
>IF _SCREEN.ActiveForm.LastControl.Valid()
> *button code here
>ENDIF
>and then if you have a special method handle it, then that method returns .T. or >.F.:
>IF _SCREEN.ActiveForm.UpdateControls()
> *button code here
>ENDIF
>Form.UpdateControl()
>RETURN THIS.LastControl.Valid()
>>3. have not decided if i will setfocus at the toolbar or at the page. but either >>way i am having trouble with the setfocus syntax. my lastcontrol currently >>(unless i/you/we come up with a better way) has the "whatever.text1" >>reference. when i try to "this.lastcontrol.setfocs()", or >>"this.&lastcontrol..setfocus()" it doesnot work. can not get the syntax right.
>The syntax you are trying does not work for the reasons I laid out for your first >question. You have to have or get an object reference to set focus to it.
used "this" like you suggested in #1. worked great.
understand that i can call the valid first, evaluate the return code and then call the setfocus as needed.
still having trouble with the syntax of the setfocus/valid. i guess part of my problem (besides being a new vfp programmer) is that i have a toplevelform.pageframe.container. grid structure. each page can have up to 3 containers, depending on the data. only one container is visible per page. each container is logically independant, most of the code is at the container level. so at the grid.column.text.setfocus, when i use "this" it has the value "osdi.omainscr.page6.disb1.disb1grid.column1.text1". osdi is toplevelform, omainscr is pageframe, page6, disb1 is one of 3 containers, disb1grid is grid, .... can not seem to get that into a generic statement that will fire a valid.
thanks - brenda
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only