jdtrent
(Joe D Trent)
March 11, 2019, 11:48pm
1
Let’s say I want to sometimes hide the Header panel in Sales Order Entry, because I do.
So I grab the GUID if sheetHeaderPanel1, get a copy of the object, and set its visibility to false. Here’s the code from the appropriate spots in the script:
Erp.UI.App.SalesOrderEntry.SheetHeaderPanel headerSheet = null;
headerSheet = (Erp.UI.App.SalesOrderEntry.SheetHeaderPanel)csm.GetNativeControlReference(“bf303fd3-c1ed-4b43-823e-0b824983a742”);
headerSheet.Visible = false;
It makes the header sheet empty, but still displays the tab at the top.
If I click on Properties with sheetHeaderPanel1 selected and then set Visible to false the header tab disappears, just like I want.
But setting it programmatically I just get a blank sheet.
Anyone able to set this successfully?
Thanks,
Joe Trent
dhewi
(Daryl Hewison)
March 12, 2019, 7:13am
2
I remember struggling with this for an annoyingly long time, but I can’t lay my hands on what solved it because in the end we took a different route to whatever we were doing at the time.
From memory, I think it was something to do with a container object to what appears to be the relevant panel, and making the parent invisible rather than the panel itself.
jdtrent
(Joe D Trent)
March 12, 2019, 6:39pm
3
Yep, it’s not looking good, or maybe worth the effort.
I made a Q&D recursion to find the parent and invisiblize that, but it had no effect. I guess we’ll just have blank sheets for now.
Thanks,
Joe
foreach (Control control in sheetTopLevelPanel1.Controls)
{
//MessageBox.Show (“control 0” + control.Name);
foreach (Control control1 in control.Controls)
{
//MessageBox.Show (“control 1” + control1.Name);
if (control1.Name == “dockableWindow3”) control1.Visible = false; // the parent of sheetHeaderPanel1
foreach (Control control2 in control1.Controls)
{
//MessageBox.Show (“control 2” + control2.Name);
if (control2.Name == “sheetHeaderPanel1”) control2.Visible = false;
/* foreach (Control control3 in control2.Controls)
{
MessageBox.Show(“control 3” + control3.Name);
} */
}
}
}
Are you doing this on initialize or load? I recommend on load.
I usually do it in the _Load
private void PartTrackerForm_Load(object sender, EventArgs args)
{
revPanel.baseDockManager.PaneFromKey("DataTagPanel").Close();
}
private Erp.UI.App.PartTracker.Panels.PartRev.PartRevPanel revPanel {
get {
return (Erp.UI.App.PartTracker.Panels.PartRev.PartRevPanel)csm.GetNativeControlReference("9d473ae1-1718-41ac-9643-c4828a09a0a2");
}
}
1 Like