最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

[转]Problem with Scrollbars within Tab Pages when show/hide field

AX 2009 William 6417浏览 0评论

原文地址:http://www.eggheadcafe.com/microsoft/Axapta-Programming/32111378/problem-with-scrollbars-within-tab-pages-when-showhide-field.aspx

Hi readers,

We have a tab page on a Dynamics form that has many controls on it. It
correctly offers a scrollbar so that we can navigate the controls.

While the form is displayed on screen, certain fields will be shown
(control.visible(true)) and hidden (control.visible(false)) in response to
user actions.

These manipulations alter the total height of the Tab Page so should affect
the scroll bar but the scroll bar does not change. Slightly resizing the
form by hand is enough to nudge Ax into recalculating the form and the
scrollbar updates. We have run tests (very simple xpo available) and cannot
make this happen programmatically.

This is causing a problem as it is not always clear that there are more
fields that need to be entered by the user.

Any ideas?

Regards (and optimistic thanks in advance)

Chris

p.s to reproduce this, I can supply an xpo which has the following (or
follow these instructions!) :

make a form with tab control with 1 tab page.
tab page has button and 2 string edits, display height: 5
tab and tab page have height/width set to column height/width to allow
resizing of form
add code to button to do stringEdit1.visible(!stringEdit1.visible))

Run form and experiment with clicking the button and resizing the form.
Note how the scroll bar does not stay up to date with the current height of
the visible contents of the tab page.

———–
MathiasFuessle chimed in with hello Chris,

this is indeed a strange behavior.
The only workaround i can give you is:
After you set the visiblity of your controls try to add this peace of code
to it.

element.design().width(element.design().widthValue()+1);
element.design().width(element.design().widthValue()-1);

It will add 1 to the current width of the formdesign.

I hope this will help you.

Kind Regards

Mathias Füßler
my blog: http://starside.eu

————

ChrisRother mentioned thank you so much Mathias, you are a genius!

I can’t believe I didn’t try that! It even works when the form is maximised.

Two further revisions of this idea later and I have a very workable solution.

Firstly I thought about +1 when showing, -1 when hiding to stop it creeping
wider and wider (not that this happens more than once or twice for a run of
the form) which worked.

Secondly and the perfecto solution is to +1 then immediately -1 so the form
bounces 1 pixel wider then snaps back to its original size.

Cheers

Chris

转载请注明:ww12345678 的部落格 | AX Helper » [转]Problem with Scrollbars within Tab Pages when show/hide field

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址