C68 Window

Anything QL Software or Programming Related.
User avatar
Whopper
Bent Pin Expansion Port
Posts: 75
Joined: Tue Oct 24, 2017 4:04 pm

C68 Window

Postby Whopper » Mon Jul 23, 2018 6:49 pm

Hi All,

Please could one (or more) or you C68 gurus out their show me some example code to define and use a window? I do not want the default sized window, but to use my own values.

I've looked at the documentation and, apart from a headache (and drinking problem) I've only achieved a remarkable amount of errors.


Thank you,

Whopper


You woke me for THAT!!!
User avatar
XorA
Super Gold Card
Posts: 561
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: C68 Window

Postby XorA » Mon Jul 23, 2018 7:10 pm

This?

viewtopic.php?f=3&t=1788&start=80#p16234

I asked a similar question ages ago!


User avatar
Whopper
Bent Pin Expansion Port
Posts: 75
Joined: Tue Oct 24, 2017 4:04 pm

Re: C68 Window

Postby Whopper » Mon Jul 23, 2018 7:51 pm

XorA wrote:This?

viewtopic.php?f=3&t=1788&start=80#p16234

I asked a similar question ages ago!


XorA,

No, unfortunately not that. I've got that. I found the definition of the WINDOWDEF-t type and can create an instance of the type. But how to create the thing? That's my problem.

Thanks for answering,

Whopper


You woke me for THAT!!!
User avatar
tofro
QL Wafer Drive
Posts: 1436
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: C68 Window

Postby tofro » Mon Jul 23, 2018 8:31 pm

The initial Window in a C68 program is called the console - It is normally opened by the startup code and defined by setting the _condetails structure.

If you want to open additional windows beyond the console, there are various ways to do that:

(

Code: Select all

chanid_t ut_con (WINDOWDEF_t *wdef)


is a low-level call to open a new window - It's not associated with C I/O in any way, and only prepared for unbuffered I/O, so your only way to use it is low-level calls like io_sstrg() and sd_... calls.

Code: Select all

chanid_t ut_window (char *name, char *details)


Is similar, with a device name like "con_512x256a0x0" and the same restrictions.

For C I/O, you need to open or fopen a device with a device name:

Code: Select all

FILE *handle;
handle = fopen (con_512x256a0x0","rw");
if (handle != NULL) {
   fprintf (handle, "%s\n", "Hello World");
}


will open a new window for C character I/O. You can use standard C I/O functions to communicate with that window. Note you will not get the nice C68 window title and border that you get on the console.

You close such a window in exactly the same way as you would close any other file.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Whopper
Bent Pin Expansion Port
Posts: 75
Joined: Tue Oct 24, 2017 4:04 pm

Re: C68 Window

Postby Whopper » Mon Jul 23, 2018 9:07 pm

tofro,

Thanks for your reply.

The last code example seems to be what I want. I tried this on Qemulator and Q68 and neither worked. They both compiled fine, but on executing the default console was was displayed with the usual end message "Press ENTER to continue."

Whopper


You woke me for THAT!!!
User avatar
tofro
QL Wafer Drive
Posts: 1436
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: C68 Window

Postby tofro » Mon Jul 23, 2018 9:20 pm

Note if you actually want to see the window, you need to give the system some time to draw it - Your program seems to end prematurely and the window is closed again so fast (because the job is done), that you have no chance to see something. Send the program into a long loop after opening the window.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO

Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 3 guests