PR# 19644 Routines {EV_FIXED}.extend_with_position_and_size, and {EV_FIXED}.set_item_position_and_size fail
Problem Report Summary
Submitter: HowardThomsonSurrey
Category: EiffelVision
Priority: Low
Date: 2020/05/29
Class: Bug
Severity: Non-critical
Number: 19644
Release: 19.12
Confidential: No
Status: Open
Responsible:
Environment: linux
Synopsis: Routines {EV_FIXED}.extend_with_position_and_size, and {EV_FIXED}.set_item_position_and_size fail
Description
See the class text in the 'To Reproduce' section.
The routine in EV_FIXED extend_with_position_and_size fails to display the EV_WIDGET, which cased me some confusion initially, and also
fails to set the widget's position:
After {EV_FIXED}.extend_with_position_and_size (widget, argument_x, argument_y, w, h)
widget.is_displayed /= True
widget.x_position /= argument_x
widget.y_position /= argument_y
After {EV_FIXED}.set_item_position_and_size (widget, x, y, w, h)
widget.x_position /= x
widget.y_position /= y
{EV_FIXED}.extend (widget) -- OK
{EV_FIXED}.set_item_position (widget, x, y) -- OK
To Reproduce
Create an instance of the class below, and call show_modal_to_window(...) on the instance:
note
description: "Summary description for {DEMO_DIALOG}."
author: "Howard Thomson"
date: "25-May-2020"
faults_to_fix: "[
The EV_DIALOG routines set_item_position_and_size and extend_with_position_and_size
fail, according to the subsequent 'check' assertions.
]"
class
DEMO_DIALOG
inherit
EV_DIALOG
redefine
create_interface_objects,
initialize
end
create
default_create
feature {NONE}
create_interface_objects
do
Precursor
create box
create label
create label_2
create label_3
create ok_button
create cancel_button
ok_button.set_text ("Connect")
cancel_button.set_text ("Cancel")
end
initialize
local
x, y, w, h: INTEGER
dx, dy: INTEGER
do
Precursor
set_title ("EV_FIXED -- Test")
extend (box)
dy := 30
label.set_text ("Test label ...")
label_2.set_text ("Test label 2 ...")
label_3.set_text ("Test label 3 ...")
x := 10
y := 10
-- This does not work, the item 'label' is not displayed!
-- box.extend_with_position_and_size (label, x, y, 79, 17)
box.extend (label)
box.set_item_position (label, x, y)
check label.x_position = x end -- OK
check label.y_position = y end -- OK
y := y + dy
box.extend (label_2)
w := label_2.width
h := label_2.height
box.set_item_position_and_size (label_2, x, y, w, h)
check label_2.x_position = x end -- FAIL
check label_2.y_position = y end -- FAIL
check label_2.width = w end
check label_2.height = h end
-- Set actual desired position of label_2
box.set_item_position (label_2, x, y)
y := y + dy
w := label_3.width
h := label_3.height
box.extend_with_position_and_size (label_3, x, y, w, h)
check label_3.is_displayed end -- FAIL
check label_3.x_position = x end -- FAIL
check label_3.y_position = y end -- FAIL
check label_3.width = w end
check label_3.height = h end
y := y + dy
box.extend (ok_button)
box.set_item_position (ok_button, x, y)
y := y + dy
box.extend (cancel_button)
box.set_item_position (cancel_button, x, y)
key_press_actions.extend (agent cancel)
box.key_press_actions.extend (agent cancel)
cancel_button.key_press_actions.extend (agent cancel)
end
box: EV_FIXED
label: EV_LABEL
label_2: EV_LABEL
label_3: EV_LABEL
ok_button: EV_BUTTON
cancel_button: EV_BUTTON
cancel (a_key: EV_KEY)
do
if a_key.code.is_equal (a_key.key_escape) then
current.destroy
end
end
end
Problem Report Interactions