Widget, similar to GroupBox C#

29 views
Skip to first unread message

Alex Tuchin

unread,
Mar 23, 2024, 2:00:11 PMMar 23
to dislin-users
Hi!

Please tell me if there is a widget in the library similar to GroupBox C#.
I did not find such a widget in the documentation.

Helmut Michels

unread,
Mar 25, 2024, 5:00:44 AMMar 25
to dislin-users
Hi,

the only possible widget group is a set of radio buttons displayed with the routine wgbox.

With best regards,

Helmut

Alex Tuchin

unread,
Mar 25, 2024, 11:25:21 AMMar 25
to dislin-users
Hi, Helmut,

I currently need to rewrite my C# applications in C++. Applications must be cross-platform. 
To do this, I wanted to use your library, which is cross-platform, fast and has good support in your person. 
In my C# applications, I link the Start and Stop buttons to the GroupBox and have the ability to move them to the place I need.
 I didn't really understand how to make it so that with the given widget sizes, the buttons can be placed one under the other where I need them.
For example, in the lower right or lower left corner of the widget.
When I start the program:
int main()
{
  int screen_width, screen_height;
  int width = 1000, height = 800;
  g.getscr (&screen_width, &screen_height);
  g.swgwin ((screen_width - width) / 2, (screen_height - height) / 2, width, height);
  int ip = g.wgini ("form");
  int ip_1 = g.wgbas (ip, "hori");
  int ip_2 = g.wgbas (ip, "hori");
  int id_pbtn1 = g.wgpbut (ip_1, "Start");
  int id_pbtn2 = g.wgpbut (ip_2, "Stop");
  g.wgfin ();
}
I see only one button Stop.
How do I make the buttons fit in the right places?

With best regards, Alex
понедельник, 25 марта 2024 г. в 12:00:44 UTC+3, mic...@dislin-software.de:

Helmut Michels

unread,
Mar 25, 2024, 11:51:13 AMMar 25
to dislin-users
Hi Alex,

a disadvantage of form widgets is that you have to define the position and size
of each widget with the routine swgwin before the widget, otherwise the
parameters of the last swgwin call will be used and widgets are overplotted.

The widgets in Dislin have a fix position. You cannot move around widgets
with the mouse.

With best regards,

Helmut 

Alex Tuchin

unread,
Mar 26, 2024, 10:45:53 AMMar 26
to dislin-users
Hi, Helmut.

I understand that in Dislin, you cannot change the position of the widget with the mouse. I did this:
  g.swgwin(80, 600, 0, 0);
  int ip_start = g.wgbas (ip, "hori");
  g.swgwin(80, 650, 0, 0);
  int ip_stop = g.wgbas (ip, "hori");
As I understand it, the button sizes in Dislin are fixed (I tried to specify different sizes). And if the label in the button is wide, then how to make the label fit completely into the button?

With best regards, Alex 

понедельник, 25 марта 2024 г. в 18:51:13 UTC+3, mic...@dislin-software.de:

Helmut Michels

unread,
Mar 27, 2024, 6:54:48 AMMar 27
to dislin-users
Hi Alex,

if the parent widget is not a 'FORM' widget, the width of widgets depends on the width of the
parent widget. If the parent widget is vertical the child widgets have nearly the same width as
the vertical parent widget (except for a few margins). A horizontal parent widget  contains
normally multiple vertical  container widgets (wgbas) as columns. The child widgets of a column has
the same width as the column. If the parent widget is a 'FORM' widget you are completely responsible 
for the layout (position and size) of the widgets. That's the whole philosophy.

If a label text does not fit in a label widget, you can increase the widget width directly with
swgwin if the parent is a 'FORM' widget. Otherwise, you have to increase the width of it's
parent. Another possibility is to change the font size with swgfnt.

With best regards,

Helmut

Alex Tuchin

unread,
Mar 27, 2024, 8:08:04 AMMar 27
to dislin-users
Hi, Helmut

As it turned out, the widget theme is very difficult for me.
As I understand it, with form I have full control over the layout and size of the widget. But it doesn't work that way for me when experimenting.
If:
  int ip = g.wgini ("form");
  g.swgwin(80, 500, 100, 50 );
  int ip_start = g.wgbas (ip, "form");
  g.swgwin(80, 650, 100, 50);
  int ip_stop = g.wgbas (ip, "form");
  int id_pbtn1 = g.wgpbut (ip_start, "StartStartStartStartStartStart");
  int id_pbtn2 = g.wgpbut (ip_stop, "StopStopStopStopStopStopStopStop");
then I don't see any buttons at all. If I write hori instead of form, then the buttons are located one under the other, but they contain only a piece of text.
What am I doing wrong?

With best regards, Alex

среда, 27 марта 2024 г. в 13:54:48 UTC+3, mic...@dislin-software.de:
Reply all
Reply to author
Forward
0 new messages