Welcome! Log In Create A New Profile

Advanced

[WD2025] getting control type in report in code

Posted by Stefan B. 
[WD2025] getting control type in report in code
June 25, 2025 10:37AM
Hello, I am trying to find out the type of controls in code for a dynamic translation in our software in reports. However, I am not able to do that. In fact, I have to skip image controls because I can't retrieve ..caption from them, because that causes a crash.
I am now using EnumControl() to retrieve the controls of a report, but I have tried it via gpwEnumControl() but it returns an empty string on the first call. And EnumControl() does work, but only returns control names, no type like gpwEnumControl(). But the property ..Type doesn't work for report controls either, so I can't determine what control it is with that either. I tried the TypeVar() function, but it doesn't return a control type. Now I check if the control name contains the text ‘IMG’, ‘PIC’ or ‘LOGO’. That works, but is definitely not a good way.
Does anyone know of a solid way that does work?

Regards, Stefan
Re: [WD2025] getting control type in report in code
June 25, 2025 10:56AM
Hi Stefan, you're right, ..Type isn't available on reports. Perhaps you could use ..Group to identify controls vs. images?

Kind regards,
Guenter Predl
gpredl@syspredl.at
Re: [WD2025] getting control type in report in code
June 25, 2025 11:00AM
Hi Guenter,
thanks for thinking with me. That would mean I would have to put the image controls of many reports in a separate group, which they are not currently in. And that would be quite a bit of work anyway. Maybe someone has another solution that requires less work.

Regards, Stefan
Re: [WD2025] getting control type in report in code
June 25, 2025 11:13AM
Hi, I can't see any other property you could use

[help.windev.com]

Kind regards,
Guenter Predl
gpredl@syspredl.at
Re: [WD2025] getting control type in report in code
June 25, 2025 12:40PM
Maybe you could use the "Notes"-field of the image control. Insert "picture" as note and then use the F4-shortcut on the other image controls. Not ideal too but faster than grouping. Then you can retrieve the ..note-property to identify images.

Edit:
Another approach: In the project explorer you can select all images of the report and associate the selection with a group.



Edited 1 time(s). Last edit at 06/25/2025 12:44PM by Markus K..
pao
Re: [WD2025] getting control type in report in code
June 25, 2025 03:03PM
Did you try usinng the ..InputMask or the ..InputType property
[help.windev.com]
[help.windev.com]

..InputMask is suposed to work in reports : [help.windev.com]

Regards

Paulo Oliveira



Edited 2 time(s). Last edit at 06/25/2025 03:10PM by pao.
Re: [WD2025] getting control type in report in code
June 25, 2025 04:10PM
Hi Paulo,

..InputMask does indeed work for reports, but I see no way to use this for identifying image controls.
But thanks for the suggestion.

Regards, Stefan
Re: [WD2025] getting control type in report in code
June 25, 2025 04:13PM
hello Markus,

it could indeed be a possibility, but both still require some work to use this. I think I'll stick with the less fancy method first.

Regards, Stefan
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: