Changing text of groupBox in runtime

Discussions related to Visual Prolog
B.Hooijenga
VIP Member
Posts: 69
Joined: 11 Jul 2002 23:01

Changing text of groupBox in runtime

Unread post by B.Hooijenga » 8 Aug 2016 13:42

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
Attachments
testdialog.PNG
testdialog.PNG (6.85 KiB) Viewed 2915 times

User avatar
Thomas Linder Puls
VIP Member
Posts: 1620
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 8 Aug 2016 22:12

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.
Regards Thomas Linder Puls
PDC

B.Hooijenga
VIP Member
Posts: 69
Joined: 11 Jul 2002 23:01

Unread post by B.Hooijenga » 9 Aug 2016 15:16

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

User avatar
Thomas Linder Puls
VIP Member
Posts: 1620
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 9 Aug 2016 18:42

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).
Regards Thomas Linder Puls
PDC

Post Reply