Page 1 of 1
Changing text of groupBox in runtime
Posted: 8 Aug 2016 13:42
by B.Hooijenga
Hello,
I have dialogControl with a groupBoxControl inside.
I want to change the text of the groupBoxControl in runtime.
It should be simple, was my idea. But no luck so far.
Code: Select all
predicates
onChangeTextButtonClick : button::clickResponder.
clauses
onChangeTextButtonClick(_Source) = button::defaultAction :-
groupBox_ctl:setText("Changed").
What do I miss?
Kind regards
Ben
Posted: 8 Aug 2016 22:12
by Thomas Linder Puls
That is a bug.
You can work around it like this:
Code: Select all
predicates
onChangeTextButtonClick : button::clickResponder.
clauses
onChangeTextButtonClick(_Source) = button::defaultAction :-
groupBox_ctl:setText("Changed"),
_ = gui_native::redrawWindow(groupBox_ctl:getVpiWindow(), uncheckedConvert(rct, null), 0,
gui_native::rdw_frame + gui_native::rdw_invalidate).
Alternatively, you can patch setText in groupBox in PFC (same method):
Code: Select all
clauses
setText(Text) :-
userControlSupport::setText(Text),
if HWnd = tryGetVpiWindow() then
_ = redrawWindow(HWnd, uncheckedConvert(rct, null), 0, rdw_frame + rdw_invalidate)
end if.
Posted: 9 Aug 2016 15:16
by B.Hooijenga
Thank you, Thomas,
A small adaptation was needed to make the internal controls in the groupBox visible. But now it works fine.
Code: Select all
predicates
onChangeTextButtonClick : button::clickResponder.
clauses
onChangeTextButtonClick(_Source) = button::defaultAction :-
groupBox_ctl:setText("Changed"),
_ = gui_native::redrawWindow(groupBox_ctl:getVpiWindow(), uncheckedConvert(rct, null), 0,
gui_native::rdw_frame + gui_native::rdw_invalidate + gui_native::rdw_allchildren).
Then I tried to patch
groupBox.pro in PFC but got an access denied error (0x00000005)
I logged in as administrator with read and write rights.
It is not a big issue for me but are there some suggestions?
Kind regards
Ben
Posted: 9 Aug 2016 18:42
by Thomas Linder Puls
Fine.
To modify the installation from the IDE you will need to start the IDE in administrator mode "Run as administrator". Alternatively, you can copy the file to another location modify it and drag it back. When you drag it back you will be prompted for Administrator elevation (this is how I remember it at least).