Memo Edit OCX Control for Navision v0.9 (VB6)
This is sample to demonstrate how to host external memo control inside Navision environment. Works with all version >=3.xx.
Source code in VB6 is included.
Code is quite messy, sorry (version 0.9
). Have no time to finish. Don't kick me too strong.
FOB and TXT for navision objects are included.
To do:
1. LoadFromFile/SaveToFile methods to save/load long text for/from control.
2. Use navsion's streams (have no idea how to do this!)
Known issues:
1. Sometimes losing focus. Host form must to be resized (I have no idea why but trying to do something).
If somebody wish to donate couple of GBPs please contact me.
http://www.mibuso.com/dlinfo.asp?FileID=558
Discuss this download here.
Comments
Seems to be another way of embedding other then using ATL commands.
The focus issue i can explain. This is navisions standard behavior, it tries to pull back the focus to one of its own controls. The only way it would work in my experience is to put this on a navision form where no other controls are located that can receive focus.
Also a sollution may be to subclass the parent form and stop events (lucky gues:) like WM_SETFOCUS or something simular. These commands i think are send to the parent form by Navision, if you filter them out then this behavior may not occur. Though i think it is quite dangerous.
I have tried to communicate with navision streams by automation and no luck. I think it is impossible in an easy way. Ofcourse you can always try sending pointers and do memory reads. But wouldn't reccomend that; rather use files in between ...
MQBus Automation 'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter
CC2 Automation 'Navision Communication Component version 2'.CommunicationComponent Yes
InMsg Automation 'Navision Communication Component version 2'.InMessage
InS InStream
XMLDom Automation 'Microsoft XML, v3.0'.DOMDocument
XMLNode Automation 'Microsoft XML, v3.0'.IXMLDOMNode
OutMsg Automation 'Navision Communication Component version 2'.OutMessage
OutS OutStream
(foud on:)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnav/html/TkNavision.asp
It appears no keyboard input commands are sent to the control.
Then try forward them to the memo box
But then again, this might be dangerous.
What i think i'm going to do is just use a dialog box for editing the text. i can still display it fine.
However, if someone does figure out a way to get around this, please let me know
Funny thing is, if i resize the window, i can get the focus to the control and type away. However, i am never able to figure out when to tell it to kill focus.
As a result, i just use this control to display data (not editable). i have a popup dialog whenever a user needs to edit the text inside the control.
The bottom line is that Navision never knows about this control (since we are drawing the window manually), so it really can't be expected to act like a control (esp. when such things are not technically supported in Navision).
The call to member SetTextStream failed. Project1 returned the following message: Object variable or With block variable not set
Any help would be appreciated
I am new to NAV but I am spending most of my time testing here and there, Actually I've succeeded to get the focus on the Memo Control .. I am sure you did that before 2 or 3 years maybe..
Anyway, Its a great work chaps =D>
can you please help me guys ..
I have OCX with some shapes and controls .. and I need to embedded it within Nav ! can I add it as a control on this project instead of the Memo and mimic functions that I need inside the project ? then create the Dll File and use it ? is it possible or not ? and if its possible what specific code should I use to prevent falling within errors ?!
Thanx in advanced,
Khalid