Post Reply 
PPL Info-Box
10-02-2023, 02:24 PM
Post: #6
RE: PPL Info-Box
(10-02-2023 01:19 PM)DG7RBN Wrote:  Hello Piotr and group,
here is a very simple PPL example for this strage behaviour:
Code:

EXPORT Test()
BEGIN
 MSGBOX("Hello world !");
END;
After closing the MSGBOX with OK, another box with an (i) marker pops up with the program name and a number "1", that must again be closed with OK. What for ?
Did nobody else get bugged by this ? ;-)
Andreas

Hi Andreas,

In PPL, almost everything is a function, including MSGBOX. The result of a function is always the result of the last executed instruction or assignment. For example, if you write a function like
Code:
EXPORT Test()
BEGIN
  1+2;
END;
the result will be 3, and you don't need to use RETURN here if it's the last operation in the function. However, you have to use RETURN if you want to exit the function conditionally and return a specific result, for example
Code:
EXPORT Test(val)
BEGIN
  IF val<10 THEN
    RETURN "less than 10";
  ENDIF;
  "more or equal 10";
END;

When you run a program from the HOME (stack) level, you will only see MSGBOX, and then the result will appear as an entry on the stack, so the second popup window won't appear again. However, from what you're describing, it seems you ran your program from the 'Program Catalog,' which always displays the result of the last executed function (program). Therefore, you received "1" as the result from MSGBOX (which always returns "1" as a function). To work around this, you can use FREEZE right after MSGBOX:
Code:
EXPORT Test()
BEGIN
  MSGBOX("Hello world !");
  FREEZE;
END;

This will prevent the second popup from appearing even when the program is run from the 'Program Catalog', but this solution has one small drawback. I wonder if you'll notice it... Wink

Best regards,
Piotr
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
PPL Info-Box - DG7RBN - 09-30-2023, 07:37 PM
RE: PPL Info-Box - komame - 10-01-2023, 04:53 AM
RE: PPL Info-Box - DG7RBN - 10-02-2023, 01:19 PM
RE: PPL Info-Box - matalog - 10-02-2023, 02:00 PM
RE: PPL Info-Box - matalog - 10-02-2023, 02:04 PM
RE: PPL Info-Box - komame - 10-02-2023 02:24 PM
PPL Info-Box --- kind of weird - DG7RBN - 10-08-2023, 12:40 PM
RE: PPL Info-Box - komame - 10-09-2023, 04:55 AM



User(s) browsing this thread: 2 Guest(s)