Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ActivePage...Not!
Message
 
 
To
07/05/2001 12:12:49
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00503661
Message ID:
00504302
Views:
13
>Nadya,
>
>I finally got this to work, but I think it was mostly because I was calling a ThisForm.Refresh in the wrong place. I'm not sure why that made a difference, but it did. I used your suggestions as well, but had a couple followup questions...
>
>>First of all, don't put this code in Valid, put it in Click event of the button.
>

Valid method doesn't allow to SetFocus() or Refresh() objects. It should give you an error. That's shy you should use Click in case of commandbutton and LostFocus in case of textbox, if you want to setfocus or refresh.

>I've heard that before, but why? Does it have to do with when events are triggered? What should go in the Valid if we can use the Click instead? I know developers who insist that it should be the other way around, but they don't seem to know why.
>
>>You also don't need to call page activate and page setfocus() methods. In each page Activate method put this code: this.Activate (e.g. each time page is activated, it's refreshed).

Here I meant put this.Refresh in each page.Activate method. Sorry for confusion.

>
>My problem here was that I needed to be at a specific field depending on the mode of the form (ie, Edit, Add, Cancel, etc.) and be able to return to whereever I came from on the form. The SetFocus call works fine in the command button Click on the origin page, but is it better to have it in the Activate of the destination page instead with a Case statement to handle the conditions?
>

Well, I'm not sure, what would be the best way to handle this situation. I don't think, page.Activate is the right place to do it. Perhaps, there sould be a new method of the form, SetMyFocus, which can be called from form.Refresh(). You have to experiment (or may be somebody has ideas, what's the best place for conditional SetFocus()).

>>Finally, I have a habit to avoid macros, if it's not necessary. In this particular case you can use:
>>loPage=evaluate("thisform.t48_page_frame1."+m.cLastPage)
>>loPage.Activate()
>
>I've heard this someplace before also... Do you know why the Eval is more stable?
>
In theory Eval works faster than &. You can read great FAQ here about macros/eval and name expression by David Fluker (?)). Also see Dragan's message for better idea.

>Thank you for your help! Renoir
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform