Prevent Subform focus on Mainform open

hi all, i am having this very annoying problem. well it is a User interface problem. i have a main form, and inside it, a subform. everytime the main form is opened, the focus is on the subform automatically. the user, has to click on a control in the main form to start keying in data in the main form. well, users find this irritating. i have even tried, a control.ACTIVATE coding on OpenForm trigger, to activate a control on the main form on open form, but this does not work. maybe some one can help me on this…

hehe… looks like i found my answer. but for the benefit of others, i am putting the answer up here… it appears that navision will auto focus on the control with the highest id. so what i did, is just cut a control on the main form, and paste it back into the main form. navision will reassign a new incremented contril id to the new pasted control. and it will focus into that control whenever the form is opened. :slight_smile:

Er, Something must be “fishy” with your form. Normally focus will return to the control which was active when the user last closed the form (unless the SaveControlInfo property is set to “No”). control.ACTIVATE in the OpenForm trigger will work under normal circumstances.

No - nothing’s “fishy” - if you use a subform on tabcontrol - you always get this subform open and there seems nothing you can do about it if there’s no data - if data is entered then the focus goes to where the user was otherwise it always ends up in subform.

Hi, The reason of your problem is the fact that the subform is editable. I have the same problem and here is the solution I put the propertie’s subform editable no And i put this code on the subform (in the form) OnActivate() CurrForm.SubformX.EDITABLE(TRUE); OnDeactivate() CurrForm.SubformX.EDITABLE(FALSE); And so no problem Bye

Oh yesssss! Thank you. I tried enabled sometime ago but thats not possible. Thanks again :slight_smile:

Also, if you set the Subform’s DelayedInsert property to Yes, this issue will go away. Look at Forms 43 Sales Invoice and 47 Sales Invoice Subform.

quote:


Originally posted by nelson
Look at Forms 43 Sales Invoice and 47 Sales Invoice Subform.


But 43 doesn’t have a tabcontrol on it and focus is always where the user left. On Tabcontrol this delayedinsert didn’t help me.

Huh? Form 43 doesn’t have a TabControl? It even has Control ID 1. Can you please check again, Tõnu? Besides that, the DelayedInsert property should be activated on the Subform, not the Main Form.

Yes Tonu, I’m trying the Nelson’s solution and that’s ok too.

I must be blonde. Yes that’s it :stuck_out_tongue: Sorry guys you were right. I somehow though that placing subform on tabcontrol changed it all but it didn’t (since example of Nelson was without it - i had a subform on tabcontrol page x)- I tried it long time ago so when I wrote before I didn’t check. So now for a week call me Blondie :slight_smile:

quote:


Originally posted by Tõnu
So now for a week call me Blondie :slight_smile:


Can you sing us “Heart of glass” then? [:p] [:D]

quote:


Originally posted by facade
I must be blonde. Yes that’s it :stuck_out_tongue: Sorry guys you were right. I somehow though that placing subform on tabcontrol changed it all but it didn’t (since example of Nelson was without it - i had a subform on tabcontrol page x)- I tried it long time ago so when I wrote before I didn’t check. So now for a week call me Blondie :slight_smile:


No problem, it is the air of [8D] HOLIDAYS [8D]

I’m glad you all seem to agree on a solution [8D] But I’m still in the dark here. I simply can’t provoke the behaviour you’re talking about - I tried removing delayed insert from the subform 47 and I tried creating a subform within the tabcontrol and it still works the way it should! PLEASE fill me in - I WANT THAT BUG [:p]

quote:


Originally posted by Steffen Voel
I’m glad you all seem to agree on a solution [8D] PLEASE fill me in - I WANT THAT BUG [:p]


Ok - here goes blondie explanation. If you create a subform on tabcontrol (lets say page 4) and you subform does not contain any data (lets take barcode/cross-ref form form as subform) you automatically end up in subform on tabcontrol page 4 - but if there are barcodes defined everything is ok. The buggie works fine :stuck_out_tongue: