Memo Edit OCX Control for Navision v0.9 (VB6)

Administrator
Member, Moderator, Administrator Posts: 2,506
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.
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

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.
0
Comments
-
Hey nice done.
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 ...In a world without Borders or Fences, who needs Windows and Gates?0 -
hmm maybe this helps:
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.aspIn a world without Borders or Fences, who needs Windows and Gates?0 -
Have you fixed the focus thing? Also, are you able to type in the memo box? i tried tweaking your code to allow both things (to no avail), so i recreated it in C++ to see if that would help. No dice... any help is appreciated.
It appears no keyboard input commands are sent to the control.0 -
Upon further research, i tried trapping every windows message (besides WM_PAINT, for obvious reasons) and displaying it in a message box. My control (when in a form all by itself) will show mouse activate, set focus, etc., but when the cursor is in the control (rich edit control), nothing happens. The cursor sits there flashing, but no keystroke messages are sent to it. Anyone have any thoughts?0
-
hmm if you try to trap events from the parent window (main form), do the key events go there?
Then try forward them to the memo boxIn a world without Borders or Fences, who needs Windows and Gates?0 -
Thats what i said. Navision is stealing the focus back. The answer should be in stopping navision from doing that.
But then again, this might be dangerous.In a world without Borders or Fences, who needs Windows and Gates?0 -
i don't think it is strictly an issue with focus - i think Navision doesn't forward the keystrokes on to the control. i imagine they have OnCmdMsg (or the equivalent) overriden somewhere, and they don't forward keystroke commands on to an OCX. Interestingly enough, the Application Designer's Guide mentions that graphical user controls aren't supported.
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 know0 -
There are a few custom messages that come through for me (some of which will crash if you don't handle correctly - at least in C++), and a few standard Windows messages, but you're right - WM_SIZE never makes it. What i did was just compare the parent window sizes every time a message was processed and adjust size if the parent did.
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).0 -
Does anybody know how to get the SetTextStream function to work properly? I would like to use this OCx for displaying a large text list so I think I need to stream it into the OCX but I'm getting the following error when trying to do it:
The call to member SetTextStream failed. Project1 returned the following message: Object variable or With block variable not set
Any help would be appreciated0 -
Heey Guys,
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,
Khalid0
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