How to resolve the algorithm Window creation step by step in the Forth programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Window creation step by step in the Forth programming language

Table of Contents

Problem Statement

Display a GUI window. The window need not have any contents, but should respond to requests to be closed.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Window creation step by step in the Forth programming language

Source code in the forth programming language

include ffl/gsv.fs

\ Open the connection to the gtk-server and load the Gtk2 definitions
s" gtk-server.cfg" s" ffl-fifo" gsv+open 0= [IF]

\ Convert the string event to a widget id
: event>widget
  0. 2swap >number 2drop d>s
;

0 value window

: window-creation
  gtk_init

  \ Create the window
  GTK_WINDOW_TOPLEVEL gtk_window_new to window

  window gtk_widget_show

  \ Wait for an event
  BEGIN
    s" WAIT" gtk_server_callback
    event>widget window =
  UNTIL

  0 gtk_exit
;

window-creation

gsv+close drop
[THEN]


Window+ w  \ create a window
View v     \ create a view
300 30 430 230 put: frameRect  \ size a rectangle for the view
frameRect " Test" docWindow v new: w  \ activate the view and window
show: w  \ display the window

  

You may also check:How to resolve the algorithm Sum and product of an array step by step in the Elixir programming language
You may also check:How to resolve the algorithm Display a linear combination step by step in the Sidef programming language
You may also check:How to resolve the algorithm Chinese zodiac step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Evolutionary algorithm step by step in the Java programming language
You may also check:How to resolve the algorithm Sort an integer array step by step in the BaCon programming language