Complex Grid

Mayada Al-Kishtini malkishtini at gmail.com
Tue Nov 1 08:30:52 EDT 2016


We use a subwindow that has only a complex grid on I, grid has no column,
and we use the logic below to dynamically draw the grid: 

This is what we do:

;; first define a row var ParmRow like below:
Do ParmRow.$cols.$add('Widths',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('btnNames',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('btnText',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('FieldNames',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('FieldDataName',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('Fieldstyle',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('FieldFormatmode',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('FieldFormatstring',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('FieldType',kCharacter,kSimplechar,1000)
Do ParmRow.$cols.$add('FieldCount',kInteger)

;; assign values to ParmRow like below:
Calculate ParmRow.Widths as '90,110,110,70,70,70,70,70,70,70'
Calculate ParmRow.btnNames as
'btnSalesID,btnLastName,btnFirstName,btntoday,btntomorrowm,btnday3,btnday4,b
tnday5,btnday6,btnday7'
Calculate ParmRow.btnText as 'SaleID ,Last Name,First
Name,today,tomorrow,day3,day4,day5,day6,day7'
Calculate ParmRow.FieldNames as
"SalesID,LastName,FirstName,Today,Tomorrow,Day3,Day4,Day5,Day6,Day7"   
Calculate ParmRow.FieldDataName as
'salesid,lastname,firstname,today,tomorrow,day3,day4,day5,day6,day7'   
Calculate ParmRow.Fieldstyle as
'CtrlViewComplexGrid,CtrlViewComplexGrid,CtrlViewComplexGrid,CtrlViewComplex
Grid,CtrlViewComplexGrid,CtrlViewComplexGrid,CtrlViewComplexGrid,CtrlViewCom
plexGrid,CtrlViewComplexGrid,CtrlViewComplexGrid'
Calculate ParmRow.FieldFormatmode as
'kFormatCharacter,kFormatCharacter,kFormatCharacter,kFormatCharacter,kFormat
Character,kFormatCharacter,kFormatCharacter,kFormatCharacter,kFormatCharacte
r,kFormatCharacter'
Calculate ParmRow.FieldFormatstring as ',,,,,,,,,'
Calculate ParmRow.Fieldtype as
'kEntry,kEntry,kEntry,kEntry,kEntry,kEntry,kEntry,kEntry,kEntry,kEntry'
Calculate ParmRow.FieldCount as (10)     ;; columns count


;;Then use the ParmRow in a logic similar to below:

Calculate ColCount as pParmRow.FieldCount
For Count from 1 to ColCount step 1
;  build divider
Calculate Width as strtok('Dividers',',')
Calculate PosDivider as PosDivider+Width
Calculate TotalColsWidth as TotalColsWidth+Width
Do iGridRef.$dividers.$add(PosDivider) Returns DividerRef     ;; DividerRef
is item reference to the ComplexGrid;
Do DividerRef.$forecolor.$assign(rgb(221,221,221))
Do DividerRef.$linestyle.$assign(8)

Calculate Labelname as strtok('pParmRow.btnNames',',')     
Calculate ColText as strtok('pParmRow.btnText',',')     
Calculate FieldName as strtok('pParmRow.FieldNames',',')     

Calculate FieldDataName as strtok('pParmRow.FieldDataName',',')
Calculate Fieldstyle as strtok('pParmRow.Fieldstyle',',')
Calculate FieldFormatMode as strtok('pParmRow.FieldFormatMode',',')
Calculate FieldFormatString as strtok('pParmRow.FieldFormatString',',')
Calculate FileType as
pick(len(pParmRow.FieldType)=0,strtok('pParmRow.FieldType',','),'kMaskedEntr
y')

;  Then label
Do iGridRef.$objs.$add(kGridColumnHeader,Count,kPushbutton,0,0,5) Returns
FieldRef     
Calculate FieldRef.$name as Labelname
Calculate FieldRef.$fieldstyle as 'CtrlLabel'
Calculate FieldRef.$align as kCenterJst
Calculate FieldRef.$backgroundtheme as kBGThemeNone
Calculate FieldRef.$buttonstyle as kNoBorderButton    
Calculate FieldRef.$enabled as kFalse
Calculate FieldRef.$text as ColText
Calculate FieldRef.$edgefloat as kEFposnClient

;  now build the cells
Do iGridRef.$objs.$add(kGridRow,Count,[FileType],0,0,5) Returns FieldRef
Calculate FieldRef.$name as FieldName
Calculate FieldRef.$fieldstyle as Fieldstyle
Calculate FieldRef.$backgroundtheme as kBGThemeNone
Calculate FieldRef.$effect as kBorderNone
Calculate FieldRef.$active as kTrue
Calculate FieldRef.$enabled as kFalse
Calculate FieldRef.$dataname as con(iGridRef.$dataname,'.',FieldDataName)
Calculate FieldRef.$formatmode as [FieldFormatMode]
Calculate FieldRef.$formatstring as FieldFormatString
Calculate FieldRef.$edgefloat as kEFposnClient
End For
Do
iGridRef.$horzscroll.$assign(pick(TotalColsWidth>iGridRef.$width,kFalse,kTru
e))     ;; make the horz scroll bar visible when  cols width exceeds the
grids width


Hope that gives you an idea on what you can do,
Mayada
-----Original Message-----
From: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] On Behalf
Of wendy
Sent: Tuesday, November 01, 2016 8:16 AM
To: 'OmnisDev List - English'
Subject: RE: Complex Grid

Hi 

I only need to re-arrange the grid in the application - the users will not
change it at all.

Kind regards
Wendy Osbaldestin
Wizard Computer Services
Tel:  01260271647
Mobile: 07740541021


-----Original Message-----
From: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] On Behalf
Of Mayada Al-Kishtini
Sent: 01 November 2016 12:11
To: 'OmnisDev List - English'
Subject: RE: Complex Grid

Hi Wendy,

I'm assuming you are referring to desktop complex grids; my question will
be, when do you need to reorder the columns? 
Do you need it when you first open the window, decide the displayed cols
order based on certain criteria or you want the user to be able to change
the cols order at runtime?

We build complex grids in our desktop app on the fly, but that is done at
$construct before the window is displayed.

HTH,
Mayada

-----Original Message-----
From: omnisdev-en [mailto:omnisdev-en-bounces at lists.omnis-dev.com] On Behalf
Of wendy
Sent: Tuesday, November 01, 2016 3:58 AM
To: 'OmnisDev List - English'
Subject: Complex Grid

Hi all

I am sure this is a simple question for someone!

I have a complex grid with 9 columns - is there a simple way to change the
order in which the columns are displayed rather than manually moving the
headings and data items?

Many thanks
Wendy Osbaldestin
Wizard Computer Services
Tel:  01260271647
Mobile: 07740541021


_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com


_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com


_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com





More information about the omnisdev-en mailing list