This one is discussed every so often - and it CAN be done - It’s not pretty, but it works. On the fields you want to have update the main form, you need to add some code on the ‘OnAfterValidate’ trigger (I did say it’s not pretty, right?). First, you need one (global) variable: Name DataType Subtype Length wscript Automation 'Windows Script Host Object Model'.WshShell
Code for each field: CREATE(wscript); wscript.SendKeys('^{UP}'); wscript.SendKeys('^{DOWN}'); CLEAR(wscript);
What this does, is using windows scripting, and in fact doing a Ctrl+PageUP and a Ctrl+PageDown after you validate the field. This is the same a user can do, to update the calculated value.
You mean CTRL+UP/DOWN, right? I was actually wondering what CTRL+PageUp/PageDown did but I guess Up/Down is what you really meant. [edit] BTW, it is (although I haven’t tested it) a pretty nifty workaround. Is it limited to some Windows versions or does this Automation Server exist on every Windows platform?
quote:
You mean CTRL+UP/DOWN, right? I was actually wondering what CTRL+PageUp/PageDown did but I guess Up/Down is what you really meant.
Originally posted by nelson - 2004 Oct 19 : 16:58:43
[:I][Oops!] - or DOH (As my idol, Homer Simpson would have said) - You are right. I belive this script would be in all versions of Windows - But I am not 100% sure In works on a 2000, and a Metaframe 2000 (Citrix)
To make a more pretty solution you could also make a callback DLL with VB6. Create an instance (withevents) of it in the mainform. When you open the form pass the instance to the subform. When you need to update the mainform call the public function in the DLL, this will trigger the custom event in the mainform. In this event you can place any code you like. option explicit public event CallBackTrigger() public sub RaiseCallBackTrigger() raiseevent CallBackTrigger end sub The drawback is that you have to ship a DLL with Navision but you can easally place this in a BLOB and autoregister it on client machines. (is there an option in this forum that allows me to mark tekst as programming code?)
quote:
(is there an option in this forum that allows me to mark tekst as programming code?)
Originally posted by janpieter - 2004 Oct 20 : 02:57:20
Yes there is option explicit public event CallBackTrigger() public sub RaiseCallBackTrigger() raiseevent CallBackTrigger end sub
use the (code) (/code) - Use the ‘[’ and ‘]’ not the ‘(’ or ‘)’ though
hmm … pitty, not a very nice style.
Unfortenatly, you are right. Maby we can get the old formatting back. Erik??
Off-topic: Thank you, after hours off looking for a dll, this topic pops up [^] http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=12304 On-topic: Tested on 2000PRO / XP PRO OK
Off topic yes: I see you point. Actually this “code” type was created to make it much easier for you all to copy the code into your own system. Also the “old” code form often “destroyed” the format of the whole page - as it did not force new lines. Instead of the code type you can use the teletype text
I think that will give you almost what you are looking for.
So far, so good. It works like described by Henrik on XP Pro SP2. … and so the question comes up: Where to put the code if you delete a line and need the header to be updated? I tried: Form - OnDeleteRecord(), no reaction. It works if you use the OnTimer Trigger, but you see the form flickering every 2 seconds (if 2000ms are used): not pretty … Any ideas?
hey i had a thought here: what you also could try to do is the following: 1. create a button on the main form 2. give this button a shortcut key. 3. hide this button under another control so users cant see it. 4. use the sendkeys function to press the button with the shortcut key. 5. program code in the onpush triggers that will refresh your form (or do anything else you like) Some examples to send shortcut keys: sendkeys('%a'); ' presses alt+a sendkeys('^a'); ' presses ctrl+a sendkeys('+a'); ' presses shift+a sendkeys('{F3}'); ' presses F3 button (uh you might not want to do that)
This might be a more stable variant of Henriks idea. I didn’t test it, but i suppose it should work.