How to dynamically place widgets in the FRAME BACKGROUND

Posted by rbf on 18-Jun-2011 04:27

I am trying to place an image in the background of a dynamic frame but I seem to be missing something as I cannot find the syntax to do it right.

Does anyone know how to do that?

All Replies

Posted by Admin on 18-Jun-2011 04:54

Does anyone know how to do that?

You'll probably have to move that image to the bottom and/or everything else to the front:

hImage:MOVE-TO-BOTTOM ().

and/or

hWidget = FRAME {&FRAME-NAME}:FIRST-CHILD:FIRST-CHILD .

DO WHILE VALID-HANDLE (hWIdget):

IF hWidget <> hImage THEN

hWidget:MOVE-TO-TOP() .

hWidget = hWidget:NEXT-SIBLING .

END.

But the result might be disappointing as not all ABL widgets support transparency (labels of checkboxes or radio-set's if I'm not mistaking).

Posted by rbf on 18-Jun-2011 09:26

Well I could try that approach but that is not the same as putting these widgets in the special FIELD-GROUP that contains the HEADER and BACKGROUND widgets.

See the HEADER and BACKGROUND phrase of the DEFINE FRAME statement.

A FRAME has a BACKGROUND attribute which "Specifies the handle for the background iteration of the frame or dialog box".

There does not seem to be any documentation on this attribute, but apparently it is a handle to the BACKGROUND FIELD-GROUP.

My question is: how to I specify a widget to be created into this FIELD-GROUP?

You can only create widgets in a FRAME in which case it always ends up in the default FIELD-GROUP and not this one.

Posted by Håvard Danielsen on 18-Jun-2011 16:49

See if you can assign widget:parent =  field-group. You need to also make the widget visible = true or hidden = false if the frame already is visible.

You can find the background field-group in the widget-tree directly under the frame. You can possiby just use framehandle:last-child, but I don't know for sure if it is last in a down frame, which have many data field-groups. It probably is, but you can also identify this when looping through the siblings by checking that the field-group:foreground attribute is false.

The background field-group is always there even if the frame is not defined with background or header.

Message was edited by: Havard Danielsen
Correction: The background field-group is always there.

Posted by rbf on 18-Jun-2011 17:46

hdaniels wrote:

See if you can assign widget:parent =  field-group.


Yes this works!

So when creating a widget, you can either set the FRAME attribute to the FRAME handle or the PARENT attribute to a FIELD-GROUP handle.

I did not know that. Cool!

Thanks,

-peter

Posted by Admin on 19-Jun-2011 03:59

Interesting...

Peter, could you share a screenshot of the result?

However I doubt that will solve the issue with the nontransparent widgets/labels.

Posted by rbf on 19-Jun-2011 14:26

I will but I am not there yet. All I have now is the proof of concept.

This thread is closed