Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disabled Checkbox in the Grid - alignment problem
Message
From
05/09/2018 01:02:58
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01661818
Message ID:
01661819
Views:
77
This message has been marked as the solution to the initial question of the thread.
>Hi everybody,
>
>I have the following code in the form's method which is called from the form's Init:
>
>
>local lcDynamicControl, loColumn, loControl
>lcDynamicControl    = [IIF(sales_pt.is_test or sales_pt.loc_suffix=0 or INLIST(sales_pt.mode,8,9), 'Check2', 'Check1')]
>
>for each loColumn in thisform.Grid1.columns
>   if type('m.loColumn.check1') = 'O'
>      loColumn.dynamiccurrentcontrol = m.lcDynamicControl
>      m.loColumn.Check1.Alignment = 2
>      m.loColumn.Check2.Alignment = 2
>      m.loColumn.Alignment = 2
>   endif
>   bindevent(m.loColumn,"MouseEnter",thisform.Grid1,"MouseEnter")
>   bindevent(m.loColumn,"MouseLeave",thisform.Grid1,"MouseLeave")	
>   
>   for each loControl in m.loColumn.controls
>
>      bindevent(m.loControl,"MouseEnter",thisform.Grid1,"MouseEnter")
>      bindevent(m.loControl,"MouseLeave",thisform.Grid1,"MouseLeave")
>      *         bindevent(m.loControl,"MouseMove",thisform.Grid1,"MouseMove")
>   endfor
>endfor
>
>with thisform.Grid1
>   * special handling for the 3 kiosk related settings (Cashless, Sales and WillCall). Keep enabled if mode=9 (kiosk)
>   .Column25.dynamiccurrentcontrol = [IIF(sales_pt.is_test or sales_pt.mode = 9, 'Check1', 'Check2')]
>   .Column26.dynamiccurrentcontrol = [IIF(sales_pt.is_test or sales_pt.mode = 9, 'Check1', 'Check2')]
>   .Column27.dynamiccurrentcontrol = [IIF(sales_pt.is_test or sales_pt.mode = 9, 'Check1', 'Check2')]
>
>   * special handling for the TST setting.  Restore original behavior (enable only when "TEST" is in the name)
>   .Column17.dynamiccurrentcontrol = [IIF(AT("TEST", UPPER(sales_pt.salespoint)) = 0 or sales_pt.loc_suffix=0 or sales_pt.mode=8, 'Check2', 'Check1')]
>   
>endwith
>
>
>I added the alignment lines today at the top of the code. The grid has many columns and in most of the columns there are two checkboxes (check1 and check2). Check2 has Enabled property set to false and check1 has it default and there is also valid method in that case.
>
>Now, the enabled checkboxes look centered in my grid but disabled look left aligned.
>
>Is it a bug in the grid or I am missing something?
>
>Please see the attached picture of what I'm seeing in the Dev. Environment.
>
>Thanks in advance.

You need to set alignment after setting the dynamiccurrentcontrol.
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform