4226 / 1795 / 211
Регистрация: 24.11.2009
Сообщений: 27,562
1

Аналог TMemo

13.04.2011, 11:49. Показов 935. Ответов 0
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//=========================================================================================================================================================================================================================================================================================================
#include <iostream>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <stdio.h>
#include <string.h>
//=========================================================================================================================================================================================================================================================================================================
using std::cout;
using std::cin;
using std::cerr;
using std::endl;
//=========================================================================================================================================================================================================================================================================================================
bool InitWindow      (Display *&PointToDisplay       ,
                      int      &NumberOfScreen       ,
                      Window   &IdentificatorOfWindow,
                      int       left                 ,
                      int       right                ,
                      int       width                ,
                      int       height               );
//=========================================================================================================================================================================================================================================================================================================
bool SetWindowManager(Display  *PointToDisplay       ,
                      char     *ClassOfProgram       ,
                      char     *arguments[]          ,
                      int       CountOfArguments     ,
                      Window    IdentificatorOfWindow,
                      int       left                 ,
                      int       right                ,
                      int       width                ,
                      int       height               ,
                      int       MinWidth             ,
                      int       MinHeight            ,
                      char     *title                ,
                      char     *TitleOfIcon          ,
                      Pixmap    Icon                 );
//=========================================================================================================================================================================================================================================================================================================
void MainLoop        (Display  *PointToDisplay       ,
                      Window    IdentificatorOfWindow);
//=========================================================================================================================================================================================================================================================================================================
int  main            (int       CountOfArguments     ,
                      char     *arguments[]          )
{
 Display *PointToDisplay;
 int      NumberOfScreen;
 Window   IdentificatorOfWindow;
 if (InitWindow(PointToDisplay, NumberOfScreen, IdentificatorOfWindow, 0 , 0 , 640 , 480))
 {
  if (SetWindowManager(PointToDisplay, (char *)"cspm", arguments, CountOfArguments, IdentificatorOfWindow, 0 , 0, 640, 480, 320, 240, (char *)"Complex steel process mashine model", (char *)"Complex steel process mashine model", 0))
  {
   MainLoop (PointToDisplay, IdentificatorOfWindow);
   return 0;
  }
  return -2;
 } 
 return -1;
}
//=========================================================================================================================================================================================================================================================================================================
bool InitWindow      (Display *&PointToDisplay       ,
                      int      &NumberOfScreen       ,
                      Window   &IdentificatorOfWindow,
                      int       left                 ,
                      int       right                ,
                      int       width                ,
                      int       height               )
{
 PointToDisplay=XOpenDisplay (NULL);
 if (PointToDisplay)
 {
  NumberOfScreen=DefaultScreen(PointToDisplay);
  IdentificatorOfWindow=XCreateSimpleWindow (PointToDisplay, RootWindow(PointToDisplay, NumberOfScreen), left, right, width, height, 1, BlackPixel(PointToDisplay, NumberOfScreen), WhitePixel(PointToDisplay, NumberOfScreen));  
  return true;
 }
 cout<<"Error: point to the display is null."<<endl;
 cerr<<"Error: point to the display is null."<<endl;    
 return false;
}
//=========================================================================================================================================================================================================================================================================================================
bool SetWindowManager(Display  *PointToDisplay       ,
                      char     *ClassOfProgram       ,
                      char     *arguments[]          ,
                      int       CountOfArguments     ,
                      Window    IdentificatorOfWindow,
                      int       left                 ,
                      int       right                ,
                      int       width                ,
                      int       height               ,
                      int       MinWidth             ,
                      int       MinHeight            ,
                      char     *title                ,
                      char     *TitleOfIcon          ,
                      Pixmap    Icon                 )
{
 XSizeHints size_hints;
 XWMHints wm_hints;
 XClassHint class_hint;
 XTextProperty windowname, iconname;
 if (!XStringListToTextProperty (&title      , 1, &windowname)||
     !XStringListToTextProperty (&TitleOfIcon, 1, &iconname  ))
 {
  cout<<"Memory error."<<endl;
  cerr<<"Memory error."<<endl;
  return false;
 }
 size_hints.flags = PPosition | PSize | PMinSize;
 size_hints.min_width = MinWidth;
 size_hints.min_height = MinHeight;
 wm_hints.flags = StateHint | IconPixmapHint | InputHint;
 wm_hints.initial_state = NormalState;
 wm_hints.input = true;
 wm_hints.icon_pixmap= Icon;
 class_hint.res_name = arguments[0];
 class_hint.res_class = ClassOfProgram;
 XSetWMProperties (PointToDisplay, IdentificatorOfWindow, &windowname, &iconname, arguments, CountOfArguments, &size_hints, &wm_hints, &class_hint);
 return true;
}
//=========================================================================================================================================================================================================================================================================================================
void MainLoop        (Display  *PointToDisplay       ,
                      Window    IdentificatorOfWindow)
{
 XEvent report;
 GC     context;
 XSelectInput (PointToDisplay, IdentificatorOfWindow, ExposureMask | KeyPressMask );
 XMapWindow   (PointToDisplay, IdentificatorOfWindow);
 while (true)
 {
  XNextEvent (PointToDisplay, &report);
  switch (report.type)
  {
   case Expose:
   context=XCreateGC (PointToDisplay, IdentificatorOfWindow, 0 , NULL);
   XSetForeground(PointToDisplay, context, BlackPixel(PointToDisplay, 0));
   XFreeGC( PointToDisplay, context);
   XFlush(PointToDisplay);
   break;
   case KeyPress :
   XCloseDisplay(PointToDisplay);
   return;
  }
 }
}
//=========================================================================================================================================================================================================================================================================================================
, как в низ окна положить многострочное текстовое поле (подобное TMemo под виндой)?
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
13.04.2011, 11:49
Ответы с готовыми решениями:

Убрать из TMemo запятые, числа расположить в столбик, и вывести все это во второе поле TMemo
Привет всем вообщем помогите с программой ) у нас есть поле TMemo в котором числа расположены числа...

4 вопроса по TMemo
Собратья по Delphi, нужен ваш совет: ( Процедурный скроллинг TMemo ) в TMemo скролинг {...

По поводу TMemo
День добрый. Вопрос к знающим людям. Как сделать так, чтобы при вводе текста, после нажатия Enter...

TMemo - Canvas
подскажите пожалуйста как в Tmemo рисовать ? или как иконки загрузить в Memo как в QIP(смайлики в...

0
13.04.2011, 11:49
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
13.04.2011, 11:49
Помогаю со студенческими работами здесь

Класс на TMemo
Есть написанный код на Делфи,который реализует очередь типа FiFo на базе массива program project1;...

FindText и TMemo
Всем привет ! Понимаю что ошибка какая то глупая, но вобще не могу понять, должно быть что то...

Очистить TMemo
Что-то делаю не так, но что не знаю. Вот код { TForm1 } procedure...

Скрол на TMemo
Есть два столбца данных, они записаны в двух TMemo нужно сделать так что бы двигая ползунок на...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru