Community
Showing results for 
Search instead for 
Do you mean 
Reply

LoadSDIView issue

Accepted Solution Solved
Copper Contributor
Posts: 10
Country: Canada
Accepted Solution

LoadSDIView issue

[ Edited ]

Hi,

 

I've added my own NavBar item and I'm loading my "fake view" form in NavBar GroupClick event (using LoadSDIView) -- this is all fine.

 

If I've clicked on "Contacts" and then onto my  button, the view is changed -- this is all fine-ish -- the application shows my form however the application still assumes i'm on the "Contacts" view (Inside Menu item View -> Contacts is still highlighted and no ViewLoaded/CurrentViewChanged events are fired.

 

If I click back on "Contacts" the view does not change as the application still assumes i'm on the Contacts page.  I'm also unable to refresh the view using any methods I've found, it simply does not reload the "Contacts" view.

 

How can I either (a) unload the contacts view when my "fake" view is shown, or (b) force an actual refresh of the view.

 

Notes:

 

1. I've tried to refresh current view, directly refresh contacs using UIContactManager however nothing works.

2. I'm using "contacts" as a reference, it does this for all "real views" when clicking from one to my custom navbar and then back to the original.

 

Thanks.

 

Update: my code (if that helps)

Creating navbar item:

NavBar nb = (NavBar)this.application.Controls["NavBar"];
posNavBarGroup = nb.Groups.Add("key","NAVBAR TEXT");

 NavBar GroupClick Handler Assignment

NavBar nb = (NavBar)this.application.Controls["NavBar"];
nb.GroupClick += new Act.Shared.Windows.Forms.Navigation.GroupClickEventHandler(NavBar_GroupClick);

 NavBar GroupClick Handler

if (e.Group.Key == "key")
{
    application.LoadSDIView(MYMainForm);
}

 



 


Accepted Solutions
Solution
Accepted by topic author TheMagu
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 10
Country: Canada

Re: LoadSDIView issue [solved]

[ Edited ]

[solved]

 

I've solved this annoying little LoadSDIView simply by not using LoadSDIView.

 

Basic Solution (for those that care, does not cover menu items):

 

During GroupClick event, check if your NavBar item is being clicked.

 

YES:

- Get the first control inside of actApplication.Controls as a panel; // Panel panel = (Panel)this.application.Controls[0];

- Set visibility of your new panel.controls[0] to false; // panel.Controls[0].Visible = false;

- Add your form to then panel // panel.Controls.add(MYform);

 

NO:

- Get the first control inside of actApplication.Controls as a panel; // Panel panel = (Panel)this.application.Controls[0];

- Check control count of panel; // int count = panel.Controls.Count;

- If count is 2, remove your form // panel.Controls.RemoveAt(1);

- Set control 0 back to visible; // panel.Controls[0].Visible = true;

 

Cheer Smiley Wink

 

Edit : Few notes

 

You should set some variables in your form so that it displays correctly:

 

MYForm.TopLevel = false;
MYForm.AutoScroll = true;
MYForm.FormBorderStyle = FormBorderStyle.None;
MYForm.Dock = DockStyle.Fill;
MYForm.Visible = true;

 

View solution in original post


All Replies
Employee
Posts: 1,163
Country: USA

Re: LoadSDIView issue

LoadSDIView doesn't actually create a new view and add it to the list of view, it's really just displaying your form as if it were. As a result, you won't be able to access the form from any of the built in events. Act may be displaying your form, but as far as it's aware whatever view you had loaded before is still loaded.

 

One possibility would be to add refresh functionality to your form by either creating a button or having it respond to events that occur on your form, such as KeyDown or some other event built into .Net winforms.

Matthew Wood
Act! SDK Support
Community Moderator
Copper Contributor
Posts: 10
Country: Canada

Re: LoadSDIView issue

Thank you mwood for the reply.  My issue is that ACT! will not refresh the old view, which is all I need to do, any ideas.  I need my application to refresh the "Contacts" view (aka, display it again) if my users click "Contacts" then onto my navbar item, then back onto "Contacts".

 

It's killing me.

I could refresh another view then refresh the contacts, however thats a lot of activity on the screen.

Solution
Accepted by topic author TheMagu
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 10
Country: Canada

Re: LoadSDIView issue [solved]

[ Edited ]

[solved]

 

I've solved this annoying little LoadSDIView simply by not using LoadSDIView.

 

Basic Solution (for those that care, does not cover menu items):

 

During GroupClick event, check if your NavBar item is being clicked.

 

YES:

- Get the first control inside of actApplication.Controls as a panel; // Panel panel = (Panel)this.application.Controls[0];

- Set visibility of your new panel.controls[0] to false; // panel.Controls[0].Visible = false;

- Add your form to then panel // panel.Controls.add(MYform);

 

NO:

- Get the first control inside of actApplication.Controls as a panel; // Panel panel = (Panel)this.application.Controls[0];

- Check control count of panel; // int count = panel.Controls.Count;

- If count is 2, remove your form // panel.Controls.RemoveAt(1);

- Set control 0 back to visible; // panel.Controls[0].Visible = true;

 

Cheer Smiley Wink

 

Edit : Few notes

 

You should set some variables in your form so that it displays correctly:

 

MYForm.TopLevel = false;
MYForm.AutoScroll = true;
MYForm.FormBorderStyle = FormBorderStyle.None;
MYForm.Dock = DockStyle.Fill;
MYForm.Visible = true;