| |

VerySource

 Forgot password?
 Register
Search
View: 2968|Reply: 8

How do I display comments next to the score?

[Copy link]

4

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Taiwan

Post time: 2020-10-15 10:00:02
| Show all posts |Read mode
Seniors...

Excuse me, I want to show comments beside the score field

But there is scope~ for example

*********
            Comments
0~5 points low
6~10 points medium
11~15 points excellent
*********

The following program code is from the senior Guanzhong Swordsman~~ How to add it to this program code?

Thank you!!

--------------------------
#ifndef Unit1H
    #define Unit1H
    #include <Classes.hpp>
    #include <ComCtrls.hpp>
    #include <Controls.hpp>
    #include <StdCtrls.hpp>
    class TForm1: public TForm
    {
      __published:
        TPageControl *PageControl1;
        TTabSheet *TabSheet1;
        TTabSheet *TabSheet2;
        TTabSheet *TabSheet3;
        TRadioButton *A1;
        TRadioButton *B1;
        TRadioButton *C1;
        TRadioButton *A2;
        TRadioButton *B2;
        TRadioButton *C2;
        TRadioButton *D2;
        TRadioButton *E2;
        void __fastcall PageControl1Change(TObject *Sender);
        void __fastcall func(TObject *Sender);
      public:
        __fastcall TForm1(TComponent* Owner);
    };
    //------------------------------------------------ ---------------------------
    extern PACKAGE TForm1 *Form1;
    //------------------------------------------------ ---------------------------
    #endif
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    #include <vcl.h>
    #pragma hdrstop
    #include "Unit1.h"
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm1 *Form1;
    //------------------------------------------------ ---------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
    {
      A1->Checked=true;
      A2->Checked=true;
      A1->Tag=1;
      B1->Tag=2;
      C1->Tag=3;
      A2->Tag=4;
      B2->Tag=5;
      C2->Tag=6;
      D2->Tag=7;
      E2->Tag=8;
      A1->OnClick=func;
      B1->OnClick=func;
      C1->OnClick=func;
      A2->OnClick=func;
      B2->OnClick=func;
      C2->OnClick=func;
      D2->OnClick=func;
      E2->OnClick=func;
    }
    //------------------------------------------------ ---------------------------
    void __fastcall TForm1::PageControl1Change(TObject *Sender)
    {
      if(PageControl1->ActivePageIndex==2)
      {
        TabSheet3->Caption=
        TabSheet1->Caption.ToIntDef(0)
        +TabSheet2->Caption.ToIntDef(0);
      }
    }
    //------------------------------------------------ ---------------------------
    void __fastcall TForm1::func(TObject *Sender)
    {
      TRadioButton * radioButton;
      radioButton=( TRadioButton *)Sender;
      if(!radioButton->Checked) return;
      switch (radioButton->Tag)
      {
        case 1: TabSheet1->Caption= 10;break;
        case 2: TabSheet1->Caption= 5;break;
        case 3: TabSheet1->Caption= 1;break;
        case 4: TabSheet2->Caption= 10;break;
        case 5: TabSheet2->Caption= 7;break;
        case 6: TabSheet2->Caption= 5;break;
        case 7: TabSheet2->Caption= 3;break;
        case 8: TabSheet2->Caption= 1;break;
      }
    }
--------------------------
Reply

Use magic Report

0

Threads

27

Posts

24.00

Credits

Newbie

Rank: 1

Credits
24.00

 China

Post time: 2020-10-15 10:15:01
| Show all posts
Senior dare not be
"Field" is the concept of database

Related to the above code you asked last time
Has nothing to do with the database
Reply

Use magic Report

4

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Taiwan

 Author| Post time: 2020-10-15 10:30:01
| Show all posts
I'm sorry... I made a mistake

I would like to ask senior Guanzhong swordsman...

Like the value of Sheet1+Sheet2 you wrote for me last time

Will appear on Sheet3

Now I want to use different scores

One more <comment> next to Sheet3

How can this be achieved?

Thank you
Reply

Use magic Report

4

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Taiwan

 Author| Post time: 2020-10-15 11:00:01
| Show all posts
E.g
If the score is on the left side~ there will be comments like the right side
*********
Score Comments
0~5 points low
6~10 points medium
11~15 points excellent
*********
Reply

Use magic Report

0

Threads

114

Posts

69.00

Credits

Newbie

Rank: 1

Credits
69.00

 China

Post time: 2020-10-15 13:00:01
| Show all posts
up, learn
Reply

Use magic Report

0

Threads

27

Posts

24.00

Credits

Newbie

Rank: 1

Credits
24.00

 China

Post time: 2020-10-15 13:15:02
| Show all posts
This is very simple, with the code given to you at the bottom, ha ha

Only need to change the code of the PageControl1Change event

      void __fastcall TForm1::PageControl1Change(TObject *Sender)
      {
        if(PageControl1->ActivePageIndex==2)
        {
          int k0,k;
          k0=TabSheet1->Caption.ToIntDef(0)+TabSheet2->Caption.ToIntDef(0);
          k=k0/5;
          switch (k)
          {
            case 2: TabSheet3->Caption=IntToStr(k0)+"__优";
            break;
            case 1: TabSheet3->Caption=IntToStr(k0)+"__中";
            break;
            default: TabSheet3->Caption=IntToStr(k0)+"__差";
          }
        }
      }
Reply

Use magic Report

4

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 France

 Author| Post time: 2020-10-15 13:30:01
| Show all posts
Sorry~ Senior

If you create a Label in TabSheet3

How to implement comments on this Label?

Trouble you again~ Thank you
Reply

Use magic Report

0

Threads

27

Posts

24.00

Credits

Newbie

Rank: 1

Credits
24.00

 China

Post time: 2020-10-15 13:45:01
| Show all posts
First pull a Label1 on TabSheet3

      void __fastcall TForm1::PageControl1Change(TObject *Sender)
      {
        if(PageControl1->ActivePageIndex==2)
        {
          int k0,k;
          k0=TabSheet1->Caption.ToIntDef(0)+TabSheet2->Caption.ToIntDef(0);
          k=k0/5;
          switch (k)
          {
            case 2:
              TabSheet3->Caption=IntToStr(k0)+"__优";
              Label1->Caption=IntToStr(k0)+"__优";
              break;
            case 1:
              TabSheet3->Caption=IntToStr(k0)+"__中";
              Label1->Caption=IntToStr(k0)+"__中";
              break;
            default:
              TabSheet3->Caption=IntToStr(k0)+"__差";
              Label1->Caption=IntToStr(k0)+"__差";
          }
        }
      }

See if that means
Reply

Use magic Report

4

Threads

10

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Taiwan

 Author| Post time: 2020-10-15 14:45:01
| Show all posts
Ok
Thank you
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