| |

VerySource

 Forgot password?
 Register
Search
View: 1602|Reply: 4

Some questions about PageControl?

[Copy link]

4

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Taiwan

Post time: 2020-1-18 23:00:01
| Show all posts |Read mode
Excuse me, seniors

I want to create a psychological test program

Want to use PageControl to build

Suppose I have three TabSheet ~ TabSheet1 and TabSheet2 are problems ~~ TabSheet3 is a grade

Here comes the problem

1. If none of the options in TabSheet1 are ticked, then the next page button is not pressed. You can press TabSheet2 to select it.

  How can this be done?

2. The options of TabSheet1 and 2 have scores respectively. How can TabSheet3 be counted?

Hope you all help me ~ Thank you
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 United States

Post time: 2020-1-25 19:18:01
| Show all posts
There is an OnChanging event in TabControl. The parameter AllowChange is used to control whether the page can be changed.

void __fastcall TForm1 :: TabControl1Changing (TObject * Sender,
      bool&AllowChange)
{
    if (! CheckBox1-> Checked) {
        AllowChange = false;
    }
}

As for the score, you can write a function to judge it. The result obtained is OK on page 3.
Reply

Use magic Report

4

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-1-26 23:00:02
| Show all posts
Thank you for your guidance

It's just that I use PageControl instead of TabControl

And the button is RadioButton

So i changed to

void __fastcall TForm1 :: PageControl1Change (TObject * Sender, bool&AllowChange)
{
    if (! RadioButton1-> Checked)
  {
        AllowChange = false;
    }
}

But an error occurs:
[C ++ Error] Unit1.cpp (32): E2316 '_fastcall TForm1 :: PageControl1Change (TObject *, bool&)' is not a member of 'TForm1'

Is this where the problem is?
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-4 14:15:02
| Show all posts
I think it is possible to customize a struct containing two quantities: bool isCheck, float count, which records whether the check is selected and the score of the checked items, and it is sufficient to judge isCheck by the second page, and by the third You can use count again on the page, does that mean? This is the dumbest way!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-31 07:30:01
| Show all posts
Declare it in the header file
__published:
void __fastcall TForm1::PageControl1Change(TObject *Sender,bool&AllowChange);
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list