[WDM20] Resizing a Static control and Looper control row [Solved]

Startbeitrag von DarrenF am 21.03.2016 15:36

Hi guys,

I have a Static control in a looper; is there a way to dynamically increase the size of the Static control based on the amount of text to be displayed in the Static control, then correspondingly increase the size of the Looper row to accommodate the new size of the Static control?

I can see ..Height might do the trick, but if this is the only way, does anyone have any example code that might handle things like the sizing of the control when things like proportional fonts are used?

Re: [WDM20] Resizing a Static control and Looper control row

Re: [WDM20] Resizing a Static control and Looper control row

there is an example of how to resize a static based on its content in the info window (when you integrate the windows into your project/theme).

As to how to resize the looper control row, I'm not sure...

Personally, I have done something of that sort by NOT using a looper, but by cloning the controls of my original row instead, which gives me full control.

Best regardsvon Fabrice Harari - am 22.03.2016 12:09

Re: [WDM20] Resizing a Static control and Looper control row

Thanks Fabrice; I see what you mean, although I like the functionality that looper controls give me as I need to allow for multiple selections etc...

I'm thinking out loud now, but I suppose I could for example, have 3 planes and put a looper on each plane. Each looper would have a specific row size adjusted to accommodate 1, 2 & 3 line Static controls. Then, the only issue is to come up with an algorithm that works out if the text I'm trying to put into the Static control would wrap onto line 2 or 3 of the Static control - if you see what I mean?von DarrenF - am 22.03.2016 12:32

Re: [WDM20] Resizing a Static control and Looper control row

Darren,

I have done this before and it does work, just with one looper.
The height-property of each individual row is your friend i.e. LOOP_Messages[nRow]..Height = 123

You can calculate the required height by using TextHeight(EDT_Text1,sText,,tMultiline)
Where (in my case) an edit-control was used in the looper to display RTF-text.

I even had an option to display a photo, or not, on each row. By having a 1 pixel height image control (invisible) and resize that one when a photo has to be displayed. Accordingly the height of the looper-row has to grow equally.

One thing I ran into was that resizing of looper-rows was too complex for the WD-framework in certain situations and caused some weird redraw effects. I managed to overcome this by first making a row BIG, like 1000 pixels. And then resize is as needed. So "shrinking" rows seems work better than increasing the height.

Re: [WDM20] Resizing a Static control and Looper control row

Re: [WDM20] Resizing a Static control and Looper control row

Thanks Arie, I'm not at my PC - did you manage to do this in WDM (android)?von DarrenF - am 22.03.2016 14:49

Re: [WDM20] Resizing a Static control and Looper control row

Darren,

my bad. I did not notice you mentioned WM. I'm talking about WD.
I can't tell you if it works in WM.von Arie - am 22.03.2016 15:42

Re: [WDM20] Resizing a Static control and Looper control row

I'll be able to tell you later... ;)

...although I'm not holding my breath as the Help pages mention that the ..Height property is available in WM Android but only for Break Header & Footer rows in the Looper control :(von DarrenF - am 22.03.2016 15:55

Re: [WDM20] Resizing a Static control and Looper control row

Hi i have used the following code in WM21 with Android and it works fine :)

Re: [WDM20] Resizing a Static control and Looper control row

Re: [WDM20] Resizing a Static control and Looper control row

Hi. The same functions exist in WM20.

Rubénvon Ruben Sanchez Peña - am 22.03.2016 17:26

Re: [WDM20] Resizing a Static control and Looper control row

As always - thanks guys!

The main reason for me seeing strange happenings was (I think) due to me using a query to (pre)populate my Looper control. Once I changed this to use something similar to Ruben's suggestion; i.e. using LooperAddLine and converting the Looper control to be populated "by programming" has solved my issues :spos:von DarrenF - am 29.03.2016 09:53

Re: [WDM20] Resizing a Static control and Looper control row

Darren,

I found also that using attributes does not always work as expected, especially when using an image as one of the controls in the looper. Same thing for radio-controls.

I had to UNbind these controls from the attribute and do something like this in the "display row event" of the looper
IMG_Arie = ATT_PhotoArievon Arie - am 29.03.2016 10:05

Hi Arie,

Yeah, based on the "pain" of getting this far, nothing would surprise me! ;)

Also, I forgot to mention, I took note of the example in the Help pages for LooperAddLine and coded it like this: