Calculating without closing gui and font problem

32 views
Skip to first unread message

Berk

unread,
Nov 2, 2022, 2:55:58 AM11/2/22
to dislin-users
Hi,

The first issue I have is with the program structure. I want to create software that performs calculations when I click the calculate button. The results should be printed to the GUI after the calculation is completed. But I can't bind my calculations to GUI. How can I interrupt the GUI loop? Should I reinitiate wgini and wgfin. I tried reawgt and doevnt but it didn't work.

My second issue is about Turkish characters. I looked at previous topics about this, but all my tries with chacod('iso1-2-3-4-5-6-7 and utf8') resulted as "<<<< Warning 3: Incorrect level in chacod! ( 0)". I tried with different fonts as well but I got the same error.

Thanks in advance.

Helmut Michels

unread,
Nov 2, 2022, 6:20:59 AM11/2/22
to dislin-users
Hi,

here is a short example code that copies the result of a calculation to a widget.
Perhaps, it helps.

----------------------
#include <stdio.h>
#include "dislin.h"

void mycalc (int id);

int id_text;

int main()
{ int ip, id_but;

  ip = wgini ("vert");

  id_but  = wgpbut (ip, "Calculate");
  swgcbk (id_but, mycalc);
  id_text = wgtxt (ip, " ");
  wgfin ();
  return 0;
}

void mycalc (int id)
{ int i, n = 0;

  for (i = 0; i < 100; i++)
    n = n + i;

  swgint (id_text, n);
}
----------------

For using Unicode characters you need a Unicode font such as Arial, convert some
Unicode numbers to a UTF8 string and set the character coding in chacod to 'UTF8'.
The following code plots some Turkish characters:

---------------
#include <stdio.h>
#include "dislin.h"

int main ()
{ int iray[4] = {286, 287, 350, 351};
  int n;
  char s[132];

  metafl ("cons");
  disini();
  winfnt ("Arial");

  n = intutf (iray, 4, s, 130);  
  chacod ("utf8");
  height (50);
  messag (s, 300, 300);
  disfin ();
}
--------------

With best regards,

Helmut

Berk

unread,
Nov 7, 2022, 11:11:31 AM11/7/22
to dislin...@googlegroups.com
Thank you for your answer. 
I use Fortran, but I could implement the first one easily, and it worked.
I couldn't solve the Turkish font problem, but it is okay.

Helmut Michels <mic...@dislin.de>, 2 Kas 2022 Çar, 13:21 tarihinde şunu yazdı:
--
You received this message because you are subscribed to the Google Groups "dislin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dislin-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dislin-users/bed2656f-c1f0-4c99-9876-ca607688bb22n%40googlegroups.com.

Atakan Abusoglu

unread,
Nov 10, 2022, 2:25:10 AM11/10/22
to dislin...@googlegroups.com
chacod("iso1")
winfnt("courier New")
messag("ÇŞĞÖÜİ",100,100)

7 Kas 2022 Pzt 19:11 tarihinde Berk <mazd...@gmail.com> şunu yazdı:

Helmut Michels

unread,
Nov 10, 2022, 5:13:13 AM11/10/22
to dislin-users
Hi,

you cannot pass directly the Turkish characters to messag. Instead, you have to convert the Turkish Unicode
numbers to a UTF8 string with the Dislin routine intutf and pass the UTF8 string to messag.

With best regards,

Helmut

Atakan Abusoglu

unread,
Nov 10, 2022, 5:57:32 AM11/10/22
to dislin...@googlegroups.com
Mr. Helmut, Thee C programs below are working with Dec-C++.

#include "dislin.h"
main()
{  
metafl("xwin");
scrmod("revers");
disini();
chacod("iso1");
winfnt("Courier New");
messag("ÇŞĞÜÖİ", 100,100);
number(123450,-1,100,200);
disfin();
}

#include "dislin.h"
main()
{  
metafl("xwin");
scrmod("revers");
disini();
complx();
eushft("Turkish","#");
messag("#C#S#G#U#O#I",100,100);
number(123450,-1,100,200);
disfin();
}

Helmut Michels <mic...@dislin.de>, 10 Kas 2022 Per, 13:13 tarihinde şunu yazdı:


--
Öğr. Gör. Atakan Abuşoğlu
Atatürk Üniversitesi Mühendislik Fakültesi Elektrik-Elektronik Böl.
25240 Erzurum
ata...@atauni.edu.tr , aabu...@yahoo.com
Tel: (442) 2314565
Fax: (442) 2360957

Berk

unread,
Nov 10, 2022, 1:27:46 PM11/10/22
to dislin-users
Hi Helmut,

I solved the problem with the help of an another user. 
I had have wanted to use Turkish characters for widgets. 
I was not clear at describing my problem. 
I used swgopt("utf8'" , "coding") before wgini and now works great. 

Best regards,
examp.png
10 Kasım 2022 Perşembe tarihinde saat 13:57:32 UTC+3 itibarıyla aabu...@gmail.com şunları yazdı:

Helmut Michels

unread,
Nov 11, 2022, 5:29:29 AM11/11/22
to dislin-users
Hi,

thank you for the hint. Yes, this will work if your editor creates already UTF8
instead of ANSI code. Otherwise, you can use the Dislin function intutf for
getting a UTF8 string.

With best regards,

Helmut
Reply all
Reply to author
Forward
0 new messages