home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / Chip_2002-05_cd1.bin / chplus / cpp / 3 / Posuv.exe / main.cpp next >
C/C++ Source or Header  |  1999-02-05  |  4KB  |  107 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "main.h"
  10. #include <stdlib.h>
  11. //---------------------------------------------------------------------------
  12. #pragma resource "*.dfm"
  13. TForm1 *Form1;
  14. //---------------------------------------------------------------------------
  15. __fastcall TForm1::TForm1(TComponent* Owner)
  16.     : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------------
  20. void __fastcall TForm1::ScrollBar1Scroll(TObject *Sender,
  21.     TScrollCode ScrollCode, int &ScrollPos)
  22. {
  23.     char buf[5];
  24.     PosEdit->Text = itoa(ScrollBar1->Position, buf, 10);
  25.     switch (ScrollCode)
  26.     {
  27.         case scLineUp:
  28.             Label2->Caption = "U₧ivatel kliknul na hornφ nebo levou Üipku posuvnφku nebo stiskl klßvesu Üipky nahoru.";
  29.             break;
  30.         case scLineDown:
  31.             Label2->Caption = "U₧ivatel kliknul na spodnφ nebo pravou Üipku posuvnφku nebo stiskl klßvesu Üipky dol∙.";
  32.             break;
  33.         case scPageUp:
  34.             Label2->Caption = "U₧ivatel kliknul na posuvnφk vlevo od madla nebo stiskl klßvesu PgUp.";
  35.             break;
  36.         case scPageDown:
  37.             Label2->Caption = "U₧ivatel kliknul na posuvnφk vpravo od madla nebo stiskl klßvesu PgDn.";
  38.             break;
  39.         case scPosition:
  40.             Label2->Caption = "User positioned the thumb tab and released it.";
  41.             break;
  42.         case scTrack:
  43.             Label2->Caption = "U₧ivatel p°emis¥uje madlo posuvnφku.";
  44.             break;
  45.         case scTop:
  46.             Label2->Caption = "U₧ivatel p°esouvß madlo posuvnφku za lev² nebo hornφ okraj posuvnφku.";
  47.             break;
  48.         case scBottom:
  49.             Label2->Caption = "U₧ivatel p°esouvß madlo posuvnφku za prav² nebo spodnφ okraj posuvnφku.";
  50.             break;
  51.         case scEndScroll:
  52.             Label2->Caption = "U₧ivatel dokonΦil p°esun madla posuvnφku.";
  53.             break;
  54.         default:
  55.             break;
  56.     }
  57. }
  58. //---------------------------------------------------------------------------
  59. void __fastcall TForm1::Button1Click(TObject *Sender)
  60. {
  61.     char buf[5];
  62.  
  63.     if (atoi(PosEdit->Text.c_str()))
  64.         ScrollBar1->Position = atoi(PosEdit->Text.c_str());
  65.     else
  66.         PosEdit->Text = itoa(ScrollBar1->Position, buf, 10);
  67.  
  68.     if (atoi(MinEdit->Text.c_str()))
  69.         ScrollBar1->Min = atoi(MinEdit->Text.c_str());
  70.     else
  71.         MinEdit->Text = itoa(ScrollBar1->Min, buf, 10);
  72.  
  73.     if (atoi(MaxEdit->Text.c_str()))
  74.         ScrollBar1->Max = atoi(MaxEdit->Text.c_str());
  75.     else
  76.         MaxEdit->Text = itoa(ScrollBar1->Max, buf, 10);
  77.  
  78.     if (atoi(LargeEdit->Text.c_str()))
  79.         ScrollBar1->LargeChange = (short) atoi(LargeEdit->Text.c_str());
  80.     else
  81.         LargeEdit->Text = itoa(ScrollBar1->LargeChange, buf, 10);
  82.  
  83.     if (atoi(SmallEdit->Text.c_str()))
  84.         ScrollBar1->SmallChange = (short) atoi(SmallEdit->Text.c_str());
  85.     else
  86.         SmallEdit->Text = itoa(ScrollBar1->SmallChange, buf, 10);
  87.         
  88.     Button1->Enabled = false;
  89. }
  90. //---------------------------------------------------------------------------
  91. void __fastcall TForm1::FormCreate(TObject *Sender)
  92. {
  93.     char buf[5];
  94.     PosEdit->Text = itoa(ScrollBar1->Position, buf, 10);
  95.     MinEdit->Text = itoa(ScrollBar1->Min, buf, 10);
  96.     MaxEdit->Text = itoa(ScrollBar1->Max, buf, 10);
  97.     LargeEdit->Text = itoa(ScrollBar1->LargeChange, buf, 10);
  98.     SmallEdit->Text = itoa(ScrollBar1->SmallChange, buf, 10);
  99. }
  100. //---------------------------------------------------------------------------
  101. void __fastcall TForm1::EnableButton(TObject *Sender, char &Key)
  102. {
  103.     Button1->Enabled = true;
  104. }
  105. //---------------------------------------------------------------------------
  106.  
  107.