PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Catch "runtime warnings"
Catch "runtime warnings"
Iniciado por schrubbi, 20,ago. 2024 15:40 - 3 respuestas
Publicado el 20,agosto 2024 - 15:40
Hi,

does anybody know how to catch runtime warnings like SetFocus not possible, because the Control is not visible?

Example:
A Layout-Control contains an Edit control. The row of the Layout is set to invisible, the Edit is set to visibile but is de-facto invisible because of the invisible layout row.

SetFocus(Edit) "fails" and shows the runtime warning "the focus cannot be given because the contrl is invisible" in the code editor. But it does not result false (it does not return a value), it does not trigger CASE ERROR, CASE EXCEPTION, WHEN EXCEPTION IN, nor ErrorOccured().

How can I catch those warnings to prevent unexpected behaviours?
(And are there ways to check the de-facto visibility beforehand?)
Miembro registrado
4 mensajes
Publicado el 24,octubre 2024 - 07:36
Try this




--
Sanjog Ghonge
Publicado el 28,octubre 2024 - 03:31
Schrubbi wrote:
Hi,

does anybody know how to catch runtime warnings like SetFocus not possible, because the Control is not visible?

Example:
A Layout-Control contains an Edit control. The row of the Layout is set to invisible, the Edit is set to visibile but is de-facto invisible because of the invisible layout row.

SetFocus(Edit) "fails" and shows the runtime warning "the focus cannot be given because the contrl is invisible" in the code editor. But it does not result false (it does not return a value), it does not trigger CASE ERROR, CASE EXCEPTION, WHEN EXCEPTION IN, nor ErrorOccured().

How can I catch those warnings to prevent unexpected behaviours?
(And are there ways to check the de-facto visibility beforehand?)


I feel strongly about it and would love to learn more about it. If you could, as you learn more, would you mind adding more information to your blog https://quordle-wordle.com
Publicado el 10,diciembre 2024 - 15:24
a écrit :
Try this




--
Sanjog Ghonge


Thank you. My problem with this specific example is that I have a variable control I have to set the focus. When setting the focus I do not know the row which the control is a child of. Or if the control is even part of a layout control.
Windev notices that the control is defacto invisible and throws the runtime warning (the small warning triangle next to the code). There should be a way to catch this warning.

Independent of my specific problem I want to know in general how to catch those warnings. A specific bug fix is not a catch. Your answer implies that instead of using try-catch in software development, we should simply not make errors. That can't be the right way.