Example #1
0
        public CPDAWindow(int x, int y, int width, int height, System.Drawing.Color wndcolor)
            : base("Captain's PDA", x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            SetSprites();

            //add some static text
            controls.Add(new CStaticText("Static:", 10, 60, 30, 26, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true));

            //add a textbox
            CTextBox aTxtbox = new CTextBox("", 60, 60, 185, 24, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, 30);

            aTxtbox.SetFocus();
            controls.Add(aTxtbox);

            //add a checkbox
            controls.Add(new CCheckbox("Checkbox", 60, 100, 60, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow));

            //add a radio button
            CCheckbox aRadioBtn = new CCheckbox("RB1", 60, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1);

            aRadioBtn.SetCheck(true);
            controls.Add(aRadioBtn);

            //add a radio button
            controls.Add(new CCheckbox("RB2", 130, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1));

            //add a listbox control
            CDropdownListBox aListbox = new CDropdownListBox(60, 150, 185, 100, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true);

            aListbox.AddItem("item 1", 1);
            aListbox.AddItem("item 2", 2);
            aListbox.AddItem("item 3", 3);
            aListbox.AddItem("item 4", 4);
            aListbox.AddItem("item 5", 5);
            aListbox.AddItem("item 6", 6);
            aListbox.AddItem("item 7", 7);
            aListbox.AddItem("item 8", 8);

            controls.Add(aListbox);

            //add a button
            controls.Add(new CButton("OK", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 48,
                                     windowRectangle.Height - 75, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
        }
Example #2
0
        public CPDAWindow(int x, int y, int width, int height, System.Drawing.Color wndcolor)
            : base("Captain's PDA", x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            SetSprites();

            //add some static text
            controls.Add(new CStaticText("Static:", 10, 60, 30, 26, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true));

            //add a textbox
            CTextBox aTxtbox = new CTextBox("", 60, 60, 185, 24, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, 30);
            aTxtbox.SetFocus();
            controls.Add(aTxtbox);

            //add a checkbox
            controls.Add(new CCheckbox("Checkbox", 60, 100, 60, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow));

            //add a radio button
            CCheckbox aRadioBtn = new CCheckbox("RB1", 60, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1);
            aRadioBtn.SetCheck(true);
            controls.Add(aRadioBtn);

            //add a radio button
            controls.Add(new CCheckbox("RB2", 130, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1));

            //add a listbox control
            CDropdownListBox aListbox = new CDropdownListBox(60, 150, 185, 100, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true);

            aListbox.AddItem("item 1", 1);
            aListbox.AddItem("item 2", 2);
            aListbox.AddItem("item 3", 3);
            aListbox.AddItem("item 4", 4);
            aListbox.AddItem("item 5", 5);
            aListbox.AddItem("item 6", 6);
            aListbox.AddItem("item 7", 7);
            aListbox.AddItem("item 8", 8);

            controls.Add(aListbox);

            //add a button
            controls.Add(new CButton("OK", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 48,
                windowRectangle.Height - 75, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
        }
Example #3
0
        public override void NewMessage(int ctrlIndex, CWindow.WindowMessages message)
        {
            switch (ctrlIndex)
            {
            case -1:
                if (message == CWindow.WindowMessages.MessageBoxOK)
                {
                    OnOK();
                }
                break;

            case 1:
                //CStaticText (hyperlink)
                break;

            //nothing
            case 2:
                //CTextbox
                break;

            //nothing
            case 3:
                //CCheckbox
                break;

            //nothing
            case 4:
                //CCheckbox (radio mode)
                if (message == CWindow.WindowMessages.LeftMouseButtonClicked)
                {
                    OnRadioBtnClicked(ctrlIndex);
                }
                break;

            case 5:
                //CCheckbox (radio mode)
                if (message == CWindow.WindowMessages.LeftMouseButtonClicked)
                {
                    OnRadioBtnClicked(ctrlIndex);
                }
                break;

            case 6:
                //CListBox
                break;

            //nothing
            case 7:
                //CButton
                if (message == CWindow.WindowMessages.LeftMouseButtonClicked)
                {
                    CWindow          thisWindow = (CWindow)this;
                    CDropdownListBox aListbox   = (CDropdownListBox)controls[5];
                    OuterSpace.theWindowMgr.MessageBox("You Selected",
                                                       aListbox.GetItemText(aListbox.GetNextSelection(1)), 0, 1, -1, ref thisWindow);

                    //OuterSpace.theWindowMgr.MessageBox("Confirm OK", "Are you sure you want to close the PDA? " + _
                    //"If so, click Yes. If not, click No. Now for a bunch of gibberish to fill space and test things.", 0, 3, -1, Me)
                }

                break;
            }
        }