Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, May 4, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix .NET Extensions
Forum to discuss the use of .NET Extensions in SalesLogix version 7 and higher. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix .NET Extensions | New ThreadView:  Search:  
 Author  Thread: embeding .NET forms in SLX tabs...
John Crumpton
Posts: 26
 
embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Mar 07 7:46 PM
fiogf49gjkf0d
is it possible to pass the SLX form's handle and size in the args array, and avoid making the win32 api calls?
something like:
in SLX....
Dim ext
ext = Application.Managed.Create("dotNetApp", "dotNetApp.Form1")
Application.Managed.Run ext, form.parent

in the .NET app...
me.parent = args(0)
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 1:25 AM
fiogf49gjkf0d
Absolutely.

Concept is exactly the same as what is done in these examples here: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=91 Only difference is that instead of loading the .NET assembly via COM, you're loading it as a .NET Extension.

You just need to pass the form's HWND property to the extension, then you can easily get it size in the same way as I did in the samples I linked to and use the SetParent API to embed a .NET control on the tab.

One of the samples does just that (embed a .NET control on a form). The only difference is how you're instanciating the object (the samples do it via COM so it would work with any version of SLX, you'll just be loading it as an extension).

Make sense?
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 9:35 AM
fiogf49gjkf0d
1:30 ? Ryan, do you ever sleep?

It does make sense...your advanced contacts tab example is what I was working from...just havn't gotten something right yet...
I'm passing the forms's HWND from SLX
but in .NET i'm not casting something right...i think
[Reply][Quote]
Duncan Cook
Posts: 164
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 10:32 AM
fiogf49gjkf0d
I think he just has an identical twin brother, also called Ryan Farley
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 10:39 AM
fiogf49gjkf0d
Quote:
Originally posted by Duncan Cook

I think he just has an identical twin brother, also called Ryan Farley


Not a twin, my clone. hehe.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 10:41 AM
fiogf49gjkf0d
Quote:
Originally posted by John Crumpton

1:30 ? Ryan, do you ever sleep?

It does make sense...your advanced contacts tab example is what I was working from...just havn't gotten something right yet...
I'm passing the forms's HWND from SLX
but in .NET i'm not casting something right...i think


I slept once. I didn't really care too much for it.

So can you give me a run down of what exactly seems to be going wrong?
[Reply][Quote]
Duncan Cook
Posts: 164
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 10:45 AM
fiogf49gjkf0d
That explains why your new avatar photo looks younger than the old one.

Any chance of revealing the cloning source code
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 10:58 AM
fiogf49gjkf0d
Quote:
Originally posted by Duncan Cook

That explains why your new avatar photo looks younger than the old one.

Any chance of revealing the cloning source code


I just turned 37 on monday my clone is still 19, so he's the one that stays up late
The cloning code is in C#, that ok with you?
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 11:11 AM
fiogf49gjkf0d
i'm passing the SLX form's HWND
it's comming in as an integer
I think my problem is trying to cast from integer to intptr... not sure how to do that...
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 11:19 AM
fiogf49gjkf0d
AHA!

in SLX...
Application.Managed.Run ext, form.HWND

in .NET
Win32.SetParent(Me.Handle, System.Convert.ToInt32(Args(0)))
Me.Show()

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 11:27 AM
fiogf49gjkf0d
Quote:
Originally posted by John Crumpton

i'm passing the SLX form's HWND
it's comming in as an integer
I think my problem is trying to cast from integer to intptr... not sure how to do that...


Don't pass it in as an int, pass it in as an object, and then convert to an IntPtr like this:

IntPtr hwnd = new IntPtr((int)Args[0]);
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 11:28 AM
fiogf49gjkf0d
Quote:
Originally posted by John Crumpton

AHA!

in SLX...
Application.Managed.Run ext, form.HWND

in .NET
Win32.SetParent(Me.Handle, System.Convert.ToInt32(Args(0)))
Me.Show()



So does that mean you have it working now then?
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 12:47 PM
fiogf49gjkf0d
yes, it works!
thanks Ryan
[Reply][Quote]
John Crumpton
Posts: 26
 
Re: embeding .NET forms in SLX tabs...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 07 2:25 PM
fiogf49gjkf0d
UHG!...
SetPArent works fine.
I'm having problems with GetWindowRect... not sure if I got it wrong when i converted the win32 class to VB....
The first time it loads, it works fine, but when the onchange event fires again, the size and position are all messed up

Here's what I have for the Win32 class... I didn't intentionally change anything from the C# version....

Class Win32
_
Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
End Function

_
Public Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef lpRect As RECT) As Boolean
End Function

_
Public Structure RECT
Public Left As Integer
Public Top As Integer
Public Right As Integer
Public Bottom As Integer

Public Sub New(ByVal left_ As Integer, ByVal top_ As Integer, ByVal right_ As Integer, ByVal bottom_ As Integer)
Left = left_
Top = top_
Right = right_
Bottom = bottom_
End Sub

Public ReadOnly Property Height() As Integer
Get
Return Bottom - Top
End Get
End Property

Public ReadOnly Property Width() As Integer
Get
Return Right - Left
End Get
End Property

Public ReadOnly Property Size() As Size
Get
Return New Size(Width, Height)
End Get
End Property

Public ReadOnly Property Location() As Point
Get
Return New Point(Left, Top)
End Get
End Property

Public Function ToRectangle() As Rectangle
Return Rectangle.FromLTRB(Left, Top, Right, Bottom)
End Function

Public Shared Function FromRectangle(ByVal rectangle As Rectangle) As RECT
Return New RECT(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom)
End Function
End Structure
End Class

and here's my Run event for the form...

Public Function Run(ByVal Args() As Object) As Object _
Implements IRunnable.Run
Try
ParentHWND = System.Convert.ToInt32(Args(0))
ResizeForm(ParentHWND)
Win32.SetParent(Me.Handle, ParentHWND)

Me.Show()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return Nothing
End Function

Private Sub ResizeForm(ByVal hwnd As IntPtr)
Dim Rect As New Win32.RECT

If Win32.GetWindowRect(hwnd, Rect) Then
Me.Size = Rect.Size
Me.Top = 2
Me.Left = 2
End If
End Sub

and here's where I'm instantiating it in SLX...

Sub AXFormChange(Sender)
Dim ext
If Application.GlobalInfo.IndexOf("LeadActivitiesObject") = -1 Then
ext = Application.Managed.Create ("SLXActivities","SLXActivities.Form1")
Application.Managed.Run ext, form.HWND
Application.GlobalInfo.Add "LeadActivitiesObject", ext
set ext = nothing
Else
ext = Application.GlobalInfo("LeadActivitiesObject")
Application.Managed.Run ext, form.HWND
set ext = Nothing
End If
End Sub
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 5/4/2024 3:04:12 AM