hi everybody we are making a development based in invoices form (header & lines). do someone knows how to control where the focus is? this means, if we are modifying lines, we have to perform some functions but if we are modifying data in header, we’ll perform some different functions… we had tried with the function OBJECTID but it didn´t work if we are in header, it seems that a record is still ‘in memory’ and navision performs the same functions that if we were editing lines… so, we’d like to know where the focus is in a header & lines form. is there any way to solve this??? zanx to all.
Hi! Form “Sales Invoice” is based on record 36 (“Sales Header”). This is the record which is selected and so - as you call - it is “in memory” as long as it is selected. You can only access the related Lines by code, from the Header-Form, or directly from the Lines-Form. So it matters, where your code is placed: Header-Form or Lines Form (or both?) …
…we are modifying lines, we have to perform some functions but if we are modifying data in header,…
So why can’t you execute your code in the OnModify-Triggers? There you would know exactly whether you are modifying a Header or a Line!? Regards, Jörg
we are not trying to modify a record placed in tbl 36 or tbl 37… suppose you are in a purchase form (header & lines). with vendor validated and all data ok (posting date, payment terms…) and you have some lines. now, in the main form you have a button. when the user pushes the button, we want the system to be able to determine where the focus were, this is in the main form (in any control of the tab) or in the subform (in any control of the subform), because depending on where the cursor were we have to decide to perform between two functions. zanx for all.
sorry, i had placed tbl 36 & 37… this is wrong… we are working in the purchase invoices form, so the system works over tbl’s 38 & 39 zanx anyway
ok working on this task, i was thinking about global variables and OnActivate & OnDeactivate triggers of the subform control in form 51 Purchase Invoice… i add a new global vble called UpDn (boolean). now i select the subform control and i push F9 (C/AL Code). i see 2 triggers: OnActivate & OnDeactivate. if i insert a code like this: OnActivate() // the subform gets the focus UpDn := FALSE; // FALSE when editing lines OnDeactivate() // the main form gets the focus UpDn := TRUE; // TRUE when editing controls in // tab control …and also in OnOpenForm… OnOpenForm() (…) UpDn := TRUE; // cursor is in any control // inside the tab, // no matter which… it seems IT WORKS!! zanx