Bazując na rożnych wpisach z forum i szczątkach dokumentacji udało mi się stworzyć w oknie edycji Zamówienia własną "zakładkę" i pola typu checkbox. Niestety niezależnie co i jak bym robił i ustawiał nie jestem w stanie spowodować aby checkboxy NIE były zaznaczone.
Próbowałem ustawiać właściwość UseRaw na "0", wołać Runtime.WindowController.Change i niestety nic. Po otworzeniu okna i zakładki - pola są zaznaczone...
Zminimalizowana klasa poniżej, z góry dziękuję za ew. wskazówki.
Kod: Zaznacz cały
[SubscribeProcedure((Procedures)Procedures.ZaNZamEdycjaSpr, "TestCustomTabZam")]
public class TestCustomTabZam : Callback
{
ClaWindow OknoGlowne;
ClaWindow TestCustomTab;
ClaWindow TestChkboxGrp;
ClaWindow TcF_Checkbox1;
ClaWindow TcF_Checkbox2;
ClaWindow SaveButton;
ClaWindow UpdateButton;
int Saved = 0;
public override void Init()
{
AddSubscription(true, 0, Events.OpenWindow, new TakeEventDelegate(OnOpenWindow));
AddSubscription(true, 0, Events.CloseWindow, new TakeEventDelegate(OnCloseWindow));
Saved = 0;
}
public void InitObjects()
{
Saved = 0;
OknoGlowne = GetWindow();
SaveButton = OknoGlowne.AllChildren["?Cli_Zapisz"];
SaveButton.OnBeforeAccepted += new TakeEventDelegate(OnClickSaveButton);
}
bool OnClickSaveButton(Procedures ProcId, int ControlId, Events Event)
{
Saved = 1;
return true;
}
bool OnOpenWindow(Procedures ProcId, int ControlId, Events Event)
{
InitObjects();
OknoGlowne = GetWindow();
TestCustomTab = OknoGlowne.AllChildren["?CurrentTab"].Children.Add(ControlTypes.tab);
TestCustomTab.TextRaw = "Test dodatkowe";
TestCustomTab.BackgroundRaw = "16777215";
TestCustomTab.Bounds = new Rectangle();
TestCustomTab.Enabled = true;
TestCustomTab.Visible = true;
TestChkboxGrp = TestCustomTab.AllChildren.Add(ControlTypes.group);
TestChkboxGrp.Visible = true;
TestChkboxGrp.BoxedRaw = "1";
TestChkboxGrp.TextRaw = "Grupa:";
TestChkboxGrp.BackgroundRaw = "16777215";
TestChkboxGrp.Bounds = new Rectangle(20, 20, 300, 70);
{
TcF_Checkbox1 = TestCustomTab.AllChildren.Add(ControlTypes.check);
TcF_Checkbox1.Visible = true;
TcF_Checkbox1.CheckedRaw = "1";
TcF_Checkbox1.UseRaw = "0";
TcF_Checkbox1.TextRaw = "Checkbox numer 1";
TcF_Checkbox1.BackgroundRaw = "16777215";
TcF_Checkbox1.Bounds = new Rectangle(30, 36, 200, 10);
// Runtime.WindowController.Change(TcF_Checkbox1.Id, "0");
// Runtime.WindowController.PostEvent(TcF_Checkbox1.Id, Events.Accepted);
}
{
TcF_Checkbox2 = TestCustomTab.AllChildren.Add(ControlTypes.check);
TcF_Checkbox2.Visible = true;
TcF_Checkbox2.CheckedRaw = "1";
TcF_Checkbox2.UseRaw = "0";
TcF_Checkbox2.TextRaw = "Checkbox numer 2";
TcF_Checkbox2.BackgroundRaw = "16777215";
TcF_Checkbox2.Bounds = new Rectangle(30, 52, 200, 10);
// Runtime.WindowController.Change(TcF_Checkbox2.Id, "0");
// Runtime.WindowController.PostEvent(TcF_Checkbox2.Id, Events.Accepted);
}
// Runtime.WindowController.PostEvent(0, Events.FullRefresh);
return true;
}
bool OnCloseWindow(Procedures ProcId, int ControlId, Events Event)
{
if (Saved == 1)
{
// zapis do bazy
}
return true;
}
bool OnAfterAccepted(Procedures ProcId, int ControlId, Events Event)
{
return true;
}
public override void Cleanup() { }
}