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!
|
|
MainView from a .net form
Posted: 13 Jun 06 7:51 PM
|
fiogf49gjkf0d How would i go about creating a new MainView from a .net form (SalesLogix .NET Extensions) |
|
|
|
Re: MainView from a .net form
Posted: 15 Jun 06 12:15 PM
|
fiogf49gjkf0d Well you don't. A common misconception with .NET Extensions is that you can choose .NET as your form type just as you do an Active Form or Legacy one. That is not the case (and one of the reasons why the feature was renamed from .NET Forms to .NET Extensions as well).
However, you can build a main view normally and embed a .NET Form on the detail screen - or any of the screens in the Main View. |
|
|
|
Re: MainView from a .net form
Posted: 19 Jun 06 4:19 AM
|
abortion pill online abortion pill online fiogf49gjkf0d You cannot create a MainView per se in .NET, but Main Views are really just specially data-bound MDI children having certain SLX characteristics.
In theory, you should be able to create a Windows Form instance as an MDI child and make the SalesLogix main window the MDI parent--this should cause your .NET form to behave like a MainView in terms of windowing, and should add it to the Window menu. Then after that, optionally you might also try adding it to the MainViews collection, if it takes it (you might have to, if you are able to, implement an interface).
I only say "in theory" because this is something that I have seen done but going about doing it is something that I haven't gotten around to doing just *yet*. |
|
|
|
Re: MainView from a .net form
Posted: 19 Jun 06 9:11 AM
|
fiogf49gjkf0d Originally posted by Jon Davis
In theory, you should be able to create a Windows Form instance as an MDI child and make the SalesLogix main window the MDI parent--this should cause your .NET form to behave like a MainView in terms of windowing, and should add it to the Window menu. Then after that, optionally you might also try adding it to the MainViews collection, if it takes it (you might have to, if you are able to, implement an interface).
I only say "in theory" because this is something that I have seen done but going about doing it is something that I haven't gotten around to doing just *yet*. |
|
I've done that many times (not with .NET Extensions yet, but I have done it many times since SLXv3) and it works quite nice with once you get the code ann right so it interacts with it's host as other entities do. I have not yet tried to implement IMainView, but even then, I am not sure you can add it to the collection??? Guess it is just something to try and see |
|
|
| |
|
Re: MainView from a .net form
Posted: 19 Jun 06 2:22 PM
|
cialis 2015 coupon cialis coupon fiogf49gjkf0d Well, that will be coming in a future article, however, the long and short of it is that you pass the HWND of the form you want to embed the .NET stuff on into the .NET Extension. Then you use the SetParent Win32API to change the parent of your .NET form or UserControl (I recommend using a UserControl) to the HWND of the form in SLX you want to embed on (Make sure you change it back or set the parent to IntPrt.Zero on dispose of your .NET object). |
|
|
| |
| |
|
Re: MainView from a .net form
Posted: 19 Jun 06 2:59 PM
|
fiogf49gjkf0d Right i have got the form in SLX but not as a child yet.. but soon i hope lol |
|
|
|
Re: MainView from a .net form
Posted: 22 Jun 06 2:10 AM
|
lexapro side effects in men lexapro side effects fiogf49gjkf0d For an MDI child form, you shouldn't need to embed on an SLX view (just set the main window as MDI parent, if that's possible with a non-managed window).
Come to think of it, attaching to an SLX view, though, well, that will certainly alleviate the issues we were discussing above (getting it in the MainView collection, having a BaseTable property, etc). |
|
|
|
Re: MainView from a .net form
Posted: 22 Jun 06 9:00 AM
|
fiogf49gjkf0d Originally posted by Jon Davis
For an MDI child form, you shouldn't need to embed on an SLX view (just set the main window as MDI parent, if that's possible with a non-managed window). |
|
Right. For the form to be an MDI child, you just need a few things to happen when it loads. Basically, finding the HWND of "MDIClient" which is child of "TmdiMain" (or "SalesLogix" if you go by window text instead of class name). Set that HWND as the parent of the form. Maximize the form, set it's border style to None, and set ChildWindow to true. I find it helpful to also override the CreateParams of the form's base and set it's style to WS_CHILDWINDOW. From there a few other tweaks you can make such as injecting a menu item into the Windows menu so a user can switch to it that way as they do other windows. I also make my nav bar button check for another running existence of the app so if clicked again it just sends a message to the other instance to notify to come to the front of the other child windows again. I will usually make a call to SetWindowText API as well to change the title bar text of the SalesLogix window to match the primary value of my custom "entity" as well. At this point it looks like just about any other MainView. I've never attempted to inherit IMainView and add to the MainView collection, but I sort of doubt that would work anyway (and besides, when I started doing this MainViews didn't exist yet so I didn't/couldn't add this into my library).
All in all it works fairly well. There might be some other gotchas along the way that I've forgotten to mention, but those are about the steps I use (and it all works great with *any* version of SLX). |
|
|
|
Re: MainView from a .net form
Posted: 22 Jun 06 9:02 AM
|
fiogf49gjkf0d But I agree, I would just go with the idea of building a blank MainView and embedding the .NET form on that. There is certainly less (by far) to have to deal with in that scenario. |
|
|
|
Re: MainView from a .net form
Posted: 22 Jun 06 1:02 PM
|
serevent asthma serevent accuhaler go fiogf49gjkf0d Yeah i was thinking about doing that with a usercontrol just dock it on top of the mainview... |
|
|
|
Re: MainView from a .net form
Posted: 30 Jun 06 6:16 PM
|
fiogf49gjkf0d Be wary that you handle OnDestroy (or whatever the event name is) to disassociate and unload the .NET usercontrol from the mainview, or for that matter for any window in SalesLogix that the .NET usercontrol hooked onto, or you may, in theory, come across access violations due to the bound HWND being destroyed. |
|
|
|