Insert new line on Form

kine
Member Posts: 12,562
Hello,
I have some small code crisis... ;-)
I need help with this problem:
I have form with table box connected to some table (record). Now, I need simulate F3 key (form is for some barcode reader which have no F3 button easy accesible). WHat is objective? After clicking on some button, new line is inserted on the end of the table box but this line is not inserted into table (is marked with *). I can't find any function, which insert new line in the table box through C/AL. I need to call OnNewRecord trigger on form etc...
Or simulate Mouse Click on new line in some field...
Thanks for any help.
I have some small code crisis... ;-)
I need help with this problem:
I have form with table box connected to some table (record). Now, I need simulate F3 key (form is for some barcode reader which have no F3 button easy accesible). WHat is objective? After clicking on some button, new line is inserted on the end of the table box but this line is not inserted into table (is marked with *). I can't find any function, which insert new line in the table box through C/AL. I need to call OnNewRecord trigger on form etc...
Or simulate Mouse Click on new line in some field...
Thanks for any help.
0
Comments
-
setting the NEXTCONTROL to itself should bring it to the next line also
if whatever you are scanning is the same length you can set your MAXLENGTH of the field to whatever it is. Once the MAXLENGTH is reached it will pop the next line.
I hope that made sence? :roll:0 -
Yes, but within C/AL code I am not able to use these possibilities...0
-
Simply insert a record variable:
LineNo: integer
SalesLine : rec 37
CLEAR(SalesLine);
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","No.");
if SalesLine.FIND('+') THEN BEGIN
LineNo:= SalesLine."Line No."+10000;
END ELSE BEGIN
LineNo:=10000;
END;
CLEAR(SalesLine);
SalesLine.VALIDATE("Document No.","No.");
SalesLine.VALIDATE("Document Type","Document Type");
SalesLine.VALIDATE("Line No.","LineNo");
SalesLine.INSERT(TRUE);Miklós Hollender
Navision Developer/Consultant
Delta Elektronik Ltd.
Budapest
Hungary
miklos.hollender@delta.hu0 -
Sorry, but I wrote, that I want to not insert the line into table. I want to insert new line on form without inserting into table. The line must be with * marked (in left fixed column). New line before OnInsert is called... only input focus on new line in table box... :!:0
-
what if you make table-box non-editable and define a rec var for the same table and a tab control at top that shows all fields for editing.
you could also add several buttons as:
NEW: Calls MyRec.INIT
SAVE: save new/changed rec. and refreshes table-box.
DELETE: deletes current rec.
When selecting a rec in table box you display values of current rec also in tab control.
this tab control could be also on separate (new) window (that has no table behind) that opens only when pressing NEW button or MODIFY button...
I know it's not Navision standard, but...®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Or... you could try a variant of the WshShell SendKeys trick...
http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=123500 -
I was curious about Windows Scripting Host and it actually does the job pretty well (in WinXP).
Just for other's that might find this thread:
On a tabular form I declared global automation for 'Windows Script Host Object Model'.WshShell.
Then used it on button:OnPush() wshShell.SendKeys('{F3}');
and it inserted a new line with * in front. (Of course calling CREATE(wshShell) should happen before calling SendKeys)®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Eureka, this is the solution...
thanks RoberMo :-)0 -
Well, thanks go to fb also...®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
...who got the idea from Henrik Helgesen's post at http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=12350
These online community things are great!
8)0 -
By the way, according to help for SendKeys, if you want to send something with CTRL (like CTRL+A to select all), it should look like:
SendKeys('^A'); or SendKeys('{^A}');
But it doesn't work from Navision code. I suspect codepage conversion happens for "^" ?
Anybody any idea?®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0 -
Does it work if the letter is lowercase?
http://support.microsoft.com/default.as ... -us;210197
Do you need to sleep before/after the SendKeys (especially if the SendKeys is triggered with a keyboard shortcut)?
http://support.microsoft.com/default.as ... -us;1386240 -
Lowercase works! So:
SendKeys('^a')
:oops: It's logical. 'A' means SHIFT+a, so I was sending CTRL+SHIFT+a. The window menu selection misleads suggesting uppercase (Select All Ctrl+A)
No sleep needed.®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions