mibuso.com

Microsoft Business Solutions online community
It is currently Thu May 23, 2013 10:07 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Memo Edit OCX Control for Navision v0.9 (VB6)
PostPosted: Fri Feb 17, 2006 3:32 pm 
Offline
Site Admin

Joined: Sun Nov 07, 1999 8:01 am
Posts: 1900
Location: Wilrijk, Belgium
Country: Belgium (be)
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 4:00 pm 
Offline

Joined: Fri Feb 28, 2003 5:53 pm
Posts: 275
Location: Dordrecht
Country: Netherlands (nl)
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?


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 11:38 am 
Offline

Joined: Tue Feb 22, 2000 8:01 am
Posts: 911
Location: Glasgow
Country: United Kingdom (uk)
Thank you for reply.

About streams... I know it's possible. I have some proprietary OCX control which works with navision streams. But I have no access to sources. I think this component has been written in C, not VB6. I've found some tiny pieces information about some "stream" class in C, but I'm not C-programmer. [Navision's stream] != [.net stream] | [VB byte array].

_________________
"Make everything as simple as possible, but not simpler."
- Albert Einstein

“A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.”
― Douglas Adams, Mostly Harmless


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 11:55 am 
Offline

Joined: Fri Feb 28, 2003 5:53 pm
Posts: 275
Location: Dordrecht
Country: Netherlands (nl)
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.asp

_________________
In a world without Borders or Fences, who needs Windows and Gates?


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Mon Feb 20, 2006 12:11 pm 
Offline

Joined: Tue Feb 22, 2000 8:01 am
Posts: 911
Location: Glasgow
Country: United Kingdom (uk)
Yes, I know.

I've tried to use this components. I don't remember why, but I've suspended my attempts.

May be I'll try later onve more time.

Now, I think, save/load using temporary file is more useful and easier to implement (I'm so lazy! :) )

_________________
"Make everything as simple as possible, but not simpler."
- Albert Einstein

“A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.”
― Douglas Adams, Mostly Harmless


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 12:37 am 
Offline

Joined: Thu Jun 02, 2005 5:53 pm
Posts: 16
Location: Texas, USA
Country: United States (us)
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 1:05 am 
Offline

Joined: Thu Jun 02, 2005 5:53 pm
Posts: 16
Location: Texas, USA
Country: United States (us)
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?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 10:58 am 
Offline

Joined: Fri Feb 28, 2003 5:53 pm
Posts: 275
Location: Dordrecht
Country: Netherlands (nl)
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 box :mrgreen:

_________________
In a world without Borders or Fences, who needs Windows and Gates?


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 11:14 am 
Offline

Joined: Tue Feb 22, 2000 8:01 am
Posts: 911
Location: Glasgow
Country: United Kingdom (uk)
Matt Keyes. Not exactly. This is stupid Navision behaviour. All keystokes goes to Navision, not to control because current focus belongs to Navision.

Today I've installed VB6 on my PC and will try to fix this.

_________________
"Make everything as simple as possible, but not simpler."
- Albert Einstein

“A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.”
― Douglas Adams, Mostly Harmless


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 11:17 am 
Offline

Joined: Fri Feb 28, 2003 5:53 pm
Posts: 275
Location: Dordrecht
Country: Netherlands (nl)
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?


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 4:32 pm 
Offline

Joined: Thu Jun 02, 2005 5:53 pm
Posts: 16
Location: Texas, USA
Country: United States (us)
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 know :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 8:58 pm 
Offline

Joined: Tue Feb 22, 2000 8:01 am
Posts: 911
Location: Glasgow
Country: United Kingdom (uk)
No, guys. I've abandoned any attampts to fix this stupid problems with focus.

I know what doing something wrong. I know what this problem is fixable (because I've already have working prprietary component). But... Something is very wrong with window messages.

I don't know why but I event can't receive WM_SIZE message.

Navision too agresively trying to got focus back to him.

May be this is problem with VB6 ActiveX implementation.

Strange, very strange.

If anybody will have any ideas, please post to this forum.

_________________
"Make everything as simple as possible, but not simpler."
- Albert Einstein

“A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.”
― Douglas Adams, Mostly Harmless


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 9:17 pm 
Offline

Joined: Thu Jun 02, 2005 5:53 pm
Posts: 16
Location: Texas, USA
Country: United States (us)
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).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 21, 2006 4:11 pm 
Offline

Joined: Fri Mar 01, 2002 8:01 am
Posts: 35
Location: Missiaauga, ON
Country: Canada (ca)
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 appreciated


Top
 Profile E-mail  
 
 Post subject: Re: Memo Edit OCX Control for Navision v0.9 (VB6)
PostPosted: Thu May 21, 2009 3:25 pm 
Offline

Joined: Thu May 21, 2009 3:13 pm
Posts: 0
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,
Khalid


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: