[Gambas-user] How do I left justify text in a DataControl

Tobias Boege taboege at ...626...
Mon Apr 13 08:57:26 CEST 2015


On Sun, 12 Apr 2015, Martin McGlensey wrote:
> Tobi,
> 
> Thanks for your response. I have a form with one datasource and twenty two
> datacontrols within that datasource. They are used to display name, address,
> city, state and other data that fits together logically on one form. Now if
> I implement your solution I need to apply it to all of the datacontrols on
> the form that display text. Can  I use a For each loop, with a test for type
> = datacontrol, to set the text position to 0? If that will not work do I
> have to set each datacontrol explicitly?
>

You can use Form.Controls as explained here in January[0], provided that
your DataControls have an easily computable naming scheme, like DataControlX
where X ranges through some numbers.

Alternatively, you can put all your DataControls in an array once when your
form opens and iterate through this array and apply your changes to each of
the DataControls.

> Should I put the loop code in the
> datasource_Change event?
> 

Yes.

Regards,
Tobi

[0] http://sourceforge.net/p/gambas/mailman/message/33222709/

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list