• Ada_GUI

    From AdaMagica@21:1/5 to All on Tue Apr 5 09:26:25 2022
    I'm playing around with Ada_GUI. The idea is excellent doing without callbacks. But it seems more like a prove of concept.
    While the features as far as available are quite easy to use and fulfil all basic needs of a gui, it's extremely cumbersome to get a halfway nice layout.
    A few questions:
    The icon in Set_Up is not displayed. Why?
    Is it possible to define Text_Boxes read only?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to AdaMagica on Tue Apr 5 21:30:47 2022
    On 2022-04-05 18:26, AdaMagica wrote:
    While the features as far as available are quite easy to use and fulfil all basic needs of a gui, it's extremely cumbersome to get a halfway nice layout.

    The layout is solely automatic, at least for now. The combination of display areas and alignment can make up for its limitations in many cases, but for those
    designs where they don't, Ada GUI is not currently a suitable choice.

    You could open an issue with a description of what you're unable to achieve, and
    ideas for an interface to achieve it, if you'd like this to be considered.

    A few questions:
    The icon in Set_Up is not displayed. Why?

    The icon is always displayed for me; the file is always in the working directory, given as a simple file name. If the file is not in the working directory then a path is needed. Without more detail I cannot guess why you don't get it.

    Is it possible to define Text_Boxes read only?

    It would be possible to add such a feature for the modifiable text widgets, and I will treat this as a feature request, but you might like to use a Background_Text for read-only output.

    --
    Jeff Carter
    "When danger reared its ugly head, he bravely
    turned his tail and fled."
    Monty Python and the Holy Grail
    60

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to Jeffrey R.Carter on Wed Apr 6 09:21:12 2022
    On 2022-04-05 21:30, Jeffrey R.Carter wrote:

    The icon is always displayed for me; the file is always in the working directory, given as a simple file name. If the file is not in the working directory then a path is needed. Without more detail I cannot guess why you don't get it.

    Update: the icon had been displaying for me, but in reviewing this I see that this is no longer the case. I don't know why this has changed. I will look into it.

    --
    Jeff Carter
    "We'll make Rock Ridge think it's a chicken
    that got caught in a tractor's nuts!"
    Blazing Saddles
    87

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From AdaMagica@21:1/5 to All on Wed Apr 6 08:52:32 2022
    More strange behaviour: I replaced it by my own Ada.ico - drum roll: favicon is still there.
    Browsers cache things.
    You're right, I deleted the cash and favicon is gone - but Ada.ico does not appear.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to Jeffrey R.Carter on Wed Apr 6 17:31:28 2022
    On 2022-04-06 09:21, Jeffrey R.Carter wrote:

    Update: the icon had been displaying for me, but in reviewing this I see that this is no longer the case. I don't know why this has changed. I will look into it.

    Displaying the icon is done by boot.html. At some point the HTML that displays it was removed in the copy that I made from Gnoga. The relevant lines are

    <meta name="generator" content="Gnoga" />
    <link rel="shortcut icon" href="favicon.ico">

    However, restoring the HTML to include this now results in the program hanging on startup. This appears to be an HTML/browser issue that needs further investigation.

    --
    Jeff Carter
    "We'll make Rock Ridge think it's a chicken
    that got caught in a tractor's nuts!"
    Blazing Saddles
    87

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From AdaMagica@21:1/5 to All on Wed Apr 6 08:29:12 2022
    Hi Jeff,
    I observe very strange behaviour wrt icon.
    Today it suddenly appeared with yesterday's executable. It's your favicon.ico. I deleted the file, and very strangely, if I start the executable again, favicon is still there.
    More strange behaviour: I replaced it by my own Ada.ico - drum roll: favicon is still there. When I kill the exe, I get:
    2022-04-06 17:18:35.69 : Deleting connection - 1
    2022-04-06 17:18:35.70 : Connection error ID-1 with message : raised ADA.IO_EXCEPTIONS.LAYOUT_ERROR : Subscript error

    2022-04-06 17:18:35.71 : HTTP Server Stopping
    2022-04-06 17:18:35.74 : Normal exit of task: main_task_00000000009D5710 [2022-04-06 17:18:35] process terminated successfully, elapsed time: 08.79s

    Christoph

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to AdaMagica on Wed Apr 6 17:38:57 2022
    On 2022-04-06 17:29, AdaMagica wrote:
    Hi Jeff,
    I observe very strange behaviour wrt icon.
    Today it suddenly appeared with yesterday's executable. It's your favicon.ico.

    Curious, see my post of a few minutes ago.

    I deleted the file, and very strangely, if I start the executable again, favicon is still there.
    More strange behaviour: I replaced it by my own Ada.ico - drum roll: favicon is still there.

    Browsers cache things.


    When I kill the exe, I get:
    2022-04-06 17:18:35.69 : Deleting connection - 1
    2022-04-06 17:18:35.70 : Connection error ID-1 with message : raised ADA.IO_EXCEPTIONS.LAYOUT_ERROR : Subscript error

    2022-04-06 17:18:35.71 : HTTP Server Stopping
    2022-04-06 17:18:35.74 : Normal exit of task: main_task_00000000009D5710 [2022-04-06 17:18:35] process terminated successfully, elapsed time: 08.79s

    The exception msg always occurs when the program ends. At that point it doesn't seem important, so I haven't put much effort into suppressing it.

    --
    Jeff Carter
    "We'll make Rock Ridge think it's a chicken
    that got caught in a tractor's nuts!"
    Blazing Saddles
    87

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From AdaMagica@21:1/5 to All on Fri Apr 8 07:05:39 2022
    More findings:
    Surprisingly, even background text generates an event when clicked upon.
    My icon Ada.ico is not displayed. If favicon.ico is present in the current directory, it is displayed even if Ada.ico is given in Set_Up.
    Very strange.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to AdaMagica on Fri Apr 8 16:31:49 2022
    On 2022-04-08 16:05, AdaMagica wrote:
    More findings:
    Surprisingly, even background text generates an event when clicked upon.

    All widgets generate mouse-click events.

    My icon Ada.ico is not displayed. If favicon.ico is present in the current directory, it is displayed even if Ada.ico is given in Set_Up.
    Very strange.

    Have you cleared cache between displaying favicon.ico and trying with Ada.ico? Have you tried renaming Ada.ico to favicon.ico?
    Does your boot.html contain the string "favicon.ico"?

    I upgraded to a new version of Firefox last night and now favicon.ico is appearing again if I have boot.html without "favicon.ico" in it. It still hangs on startup for the version of boot.html with it.

    ada_gui-gnoga-server-connection.adb at line 574 modifies boot.html to replace "favicon.ico" with the icon name passed to Set_Up, if it contains that string and a non-null icon name was given. Apparently that, or processing the modified file, hangs. If boot.html does not contain that string, apparently favicon.ico is used if it exists.

    So currently it seems that if you want an icon, it has to be named favicon.ico and the string passed to Set_Up is ignored.

    I'll investigate further.

    --
    Jeff Carter
    "Blessed are they who convert their neighbors'
    oxen, for they shall inhibit their girth."
    Monty Python's Life of Brian
    83

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to Jeffrey R.Carter on Fri Apr 8 22:56:00 2022
    On 2022-04-08 16:31, Jeffrey R.Carter wrote:

    I upgraded to a new version of Firefox last night and now favicon.ico is appearing again if I have boot.html without "favicon.ico" in it. It still hangs
    on startup for the version of boot.html with it.

    ada_gui-gnoga-server-connection.adb at line 574 modifies boot.html to replace "favicon.ico" with the icon name passed to Set_Up, if it contains that string and a non-null icon name was given. Apparently that, or processing the modified
    file, hangs. If boot.html does not contain that string, apparently favicon.ico
    is used if it exists.

    The replacement is done with procedure String_Replace, in Ada_Gui.Gnoga:

    procedure String_Replace
    (Source : in out Ada.Strings.Unbounded.Unbounded_String;
    Pattern : in String;
    Replacement : in String);
    -- Replace all instances of Pattern with Replacement in Source

    However, there is a logic error in String_Replace: if Pattern = Replacement, it becomes an infinite loop. So the default value of Icon for Set_Up, or an explicit value of "favicon.ico", results in an infinite loop when this replacement is done.

    Correcting it to return immediately in that case, and using the version of boot.html that contains the text that results in the replacement being performed, I get favicon.ico with the default value for Icon, and the specified file with an explicit value, provided that I clear cache between runs.

    I will update Github with the correction soon, but in the meantime, interested persons can make the change themselves to use a different icon file.

    --
    Jeff Carter
    "Blessed are they who convert their neighbors'
    oxen, for they shall inhibit their girth."
    Monty Python's Life of Brian
    83

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From AdaMagica@21:1/5 to Jeffrey R.Carter on Sat Apr 9 04:59:50 2022
    Jeffrey R.Carter schrieb am Freitag, 8. April 2022 um 16:31:51 UTC+2:
    On 2022-04-08 16:05, AdaMagica wrote:
    My icon Ada.ico is not displayed. If favicon.ico is present in the current directory, it is displayed even if Ada.ico is given in Set_Up.
    Very strange.
    Have you cleared cache between displaying favicon.ico and trying with Ada.ico?
    Have you tried renaming Ada.ico to favicon.ico?

    I renamed it, leaving Ada.ico in Set_Up -- and lo and behold, it is displayed. Seems the name given in Set_Up is ignored and favicon is used if it exists.

    Does your boot.html contain the string "favicon.ico"?

    No, it's what is in the current download. I didn't touch any file.

    I will update Github with the correction soon

    Fine, I'll wait for the new version.

    Further defects that I found:
    There is no dialog with just one OK button. A work-around is using an empty string as a second button (it does not show prominently).
    LF does not work in the Ada_GUI.Dialogs.Selected_Button Text parameter. I would need a long Text extending over several lines, for instance "Instructions ...".
    Displaying "&euro;" in a Text_Box (via Set_Text) does not work as expected (the HTML string appears, not the € sign).
    However directly typing € in the Text_Box works.

    But don't worry. I'm just playing around - no real application.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to AdaMagica on Sat Apr 9 15:38:34 2022
    On 2022-04-09 13:59, AdaMagica wrote:

    I renamed it, leaving Ada.ico in Set_Up -- and lo and behold, it is displayed.
    Seems the name given in Set_Up is ignored and favicon is used if it exists.

    This is the behavior with the version of boot.html without "favicon.ico".

    Fine, I'll wait for the new version.

    The changes have been uploaded to Github, including boot.html with "favicon.ico"
    in it (in the Test directory). With these changes, the icon file name passed to Set_Up is used (at least for me on Xubuntu 21.10/Firefox 99.0/GNAT 11.2.0). What
    is your platform/browswer/compiler version?

    Further defects that I found:
    There is no dialog with just one OK button. A work-around is using an empty string as a second button (it does not show prominently).

    Show_Message_Box does this, which is why the precondition on Dialogs.Selected_Test only allow two or more buttons. You could also change the precondition to allow a length of one.

    LF does not work in the Ada_GUI.Dialogs.Selected_Button Text parameter. I would need a long Text extending over several lines, for instance "Instructions ...".

    I haven't tried that. You might also try "<br>", but I suspect button text is a single line. I'll look into this at some point.

    Displaying "&euro;" in a Text_Box (via Set_Text) does not work as expected (the HTML string appears, not the € sign).
    However directly typing € in the Text_Box works. HTML attributes do work in the initial text for a Background_Text (and maybe also a label), but not in text provided through Set_Text.

    Yes, Text_Areas and Text_Boxes don't handle HTML attributes (or any other kind that I've found).

    But don't worry. I'm just playing around - no real application.

    The feedback is useful.

    --
    Jeff Carter
    "[B]ecause of our experience in security, we are convinced
    that C is too error-prone. Its loose typing, its unsafe
    bitfields management, too many compiler dependent behaviors,
    etc. easily lead to vulnerabilities."
    EwoK developers
    163

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From AdaMagica@21:1/5 to Jeffrey R.Carter on Sun Apr 10 04:45:18 2022
    Jeffrey R.Carter schrieb am Samstag, 9. April 2022 um 15:38:36 UTC+2:
    This is the behavior with the version of boot.html without "favicon.ico".
    Fine, I'll wait for the new version.
    The changes have been uploaded to Github, including boot.html with "favicon.ico"
    in it (in the Test directory). With these changes, the icon file name passed to
    Set_Up is used (at least for me on Xubuntu 21.10/Firefox 99.0/GNAT 11.2.0). What
    is your platform/browswer/compiler version?

    I got the latest zip from GitHub and checked, there is a line in boot.html:
    <link rel="shortcut icon" href="favicon.ico">
    Now Ada.ico as set in Set_Up is shown on Windows 8.1/Firefox 99.0/Gnat CE 2021.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From AdaMagica@21:1/5 to Jeffrey R.Carter on Sun Apr 10 05:12:08 2022
    Jeffrey R.Carter schrieb am Samstag, 9. April 2022 um 15:38:36 UTC+2:
    There is no dialog with just one OK button. A work-around is using an empty string as a second button (it does not show prominently).
    Show_Message_Box does this, which is why the precondition on

    Ah, thanks, I overlooked this feature.
    Contrary to New_Button, this text does not observe HTML attributes. I had liked a bold or bigger title line.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to AdaMagica on Sun Apr 10 15:23:43 2022
    On 2022-04-10 13:45, AdaMagica wrote:

    Now Ada.ico as set in Set_Up is shown on Windows 8.1/Firefox 99.0/Gnat CE 2021.

    Glad to hear it.

    --
    Jeff Carter
    "Ada has made you lazy and careless. You can write programs in C that
    are just as safe by the simple application of super-human diligence."
    E. Robert Tisdale
    72

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)