Project

General

Profile

Bug #10620

Missing getter when converting frame attributes in MESSAGE statements

Added by Paula Păstrăguș 10 months ago. Updated 10 months ago.

Status:
Review
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

warning.png (7.39 KB) Paula Păstrăguș, 09/26/2025 06:52 AM

History

#1 Updated by Paula Păstrăguș 10 months ago

When a frame attribute (e.g. PIXELS-PER-ROW) is used in a MESSAGE statement, the conversion generates a call to asWidget() instead of the proper getter method. This results in incorrect code being produced.

For example, this code:

message "pixels per row = " + string(frame fr:PIXELS-PER-ROW).
message frame fr:PIXELS-PER-ROW.

is converted as:

message(concat(new character("pixels per row = "), valueOf(frFrame.asWidget())));
message(frFrame.asWidget());

#2 Updated by Paula Păstrăguș 10 months ago

  • Assignee set to Paula Păstrăguș

#3 Updated by Paula Păstrăguș 10 months ago

  • Status changed from New to WIP
  • reviewer Constantin Asofiei added

Created task branch 10620a.

#4 Updated by Paula Păstrăguș 10 months ago

  • % Done changed from 0 to 100
  • Status changed from WIP to Review

Committed solution as rev 16185.

Constantin, please review.

The only attributes that were incorrectly converted are PIXELS-PER-ROW and PIXELS-PER-COLUMN. According to the documentation, these attributes are accessible exclusively through the session handle. However, in practice, they can also be accessed via a frame (though not through a widget or a window).

This testcase:

def frame fr.

message "px row = " + string(frame fr:PIXELS-PER-ROW).
message "px col = " + string(frame fr:PIXELS-PER-COLUMN).

message session:PIXELS-PER-COLUMN.
message session:PIXELS-PER-ROW.

message frame fr:PIXELS-PER-ROW.
message frame fr:PIXELS-PER-COLUMN.

is now converted as:

         message(concat(new character("px row = "), valueOf(frFrame.getPixelsPerRow())));
         message(concat(new character("px col = "), valueOf(frFrame.getPixelsPerColumn())));

         message(SessionUtils.getPixelsPerColumn());
         message(SessionUtils.getPixelsPerRow());

         message(frFrame.getPixelsPerRow());
         message(frFrame.getPixelsPerColumn());

But, I’ve come across another conversion issue as well... I’ll detail it in a separate post shortly, just let me know whether it should be addressed here too, or if it’s already a known matter.

#5 Updated by Paula Păstrăguș 10 months ago

Testcase:

def var f1 as char.
def frame fr f1 view-as fill-in.

message f1:BOX. // or other attribute, for example PIXELS-PER-ROW / COLUMN.

In FWD, the build fails. I believe this is a conversion issue, because the code is converted as:

    message(frFrame.widgetF1().isBox());

However, isBox() is not defined for type FillInWidget.

In 4GL, this produces no syntax error, instead, only a runtime warning is shown:

I don’t think this will be easy to address. Right now, I can’t identify a simple solution.

#6 Updated by Constantin Asofiei 10 months ago

Paula Păstrăguș wrote:

I don’t think this will be easy to address. Right now, I can’t identify a simple solution.

Please don't focus on this; this is something known and a limitation of FWD for now.

About 10620a: please don't continue working with this, unless you've seen an issue in the customer's application. It needs more changes, as for example this works:

def var h as handle.
h = frame fr:handle.
message h:pixels-per-row.

So we need the pixels-per-row and pixels-per-column extracted in a different interface, with handle.unwrap explicit APIS, interface registered in CommonHandle, SessionUtils, implemented by CommonFrame, etc.

#7 Updated by Paula Păstrăguș 10 months ago

In the customer application I’m working on, the PIXELS-PER-ROW and PIXELS-PER-COLUMN attributes are only used as documented, through the session, and this works correctly in FWD.

#8 Updated by Constantin Asofiei 10 months ago

Paula Păstrăguș wrote:

In the customer application I’m working on, the PIXELS-PER-ROW and PIXELS-PER-COLUMN attributes are only used as documented, through the session, and this works correctly in FWD.

Thanks, focus on the urgent/current tasks and get back to this when you have some down time. As an example you can see how SUPER-PROCEDURES is being managed.

#9 Updated by Paula Păstrăguș 10 months ago

Oki, thanks Constantin for your prompt feedback!

Also available in: Atom PDF