Is there a tool or a recommended sequence of steps to take a grid DW with mismatching columns and return it to a state where like fields and headers are in the same column?
Over the years customizations of grids have made our DWs appearing unruly internally (See Disrupted_Example.png) and may appear mismatched when displayed to the user at runtime. I'd like to be able to resolve this with code (outside the painter or edit source). I've been trying accomplish this feat with a utility but I have had limited success. Any suggestions on how to consistently resolve this?
There preferred outcome would be like the image DW_Realigned.png.
I'm looking to do this with an EXE as opposed to changing the export file manually. Instead of exporting the file I've been manipulating the DW with the Modify command. As you have mentioned in steps 2 & 6, I've found that changing the DWs type before adjust the columns allows for them to be realigned. But upon switching back to grid it doesn't always take (gridlines do not appear) I've attempt to adjust the property "dataWindow.grid.lines=0" but it doesn't seem to change the results.
Can the same result be had without exporting the DW source?
BTW - I am lucky (Ref Step 3). The text fields do match nameOfColumn + "_t".
Regards
It's difficult to answer these questions without having an exported dw and your code.
With "switching back to grid ", you mean that you do a modify() of the processing back to have a value of 1?
So... do I understand well that you want to leave the dw "as is" and simply modify the positions always before using them in the code?
A few things that come into my mind:
1. Make sure that the first line of source code with the version information is correct. When you migrate your application to a higher powerbuilder version, that information is not modfied until you do some change. For example, I still have datawindows in 2017 and 2019 which show "release 12.6;"
2. Try setting "grid.lines=1" (=off) first, then "grid.columnmove=yes" and then "grid.lines=0" (=on). ( BTW: I don't know why 0 is the value for 'on' and 1 the value for 'off' and 2 for 'display only'. It doesn't make sense at all, but I guess it's too late to change it after all these years of powerbuilder).
3. Doing everything from code, you might have to set more attributes than just the "x" and "widths", you probably also have to set the tabsequences in order from left to right and make sure there's a tiny gap between the columns and also the text labels. (haven't tried this, just comes to mind).
The advantage of doing an "import" using the IDE, is that the attributes will be automatically adjusted, event if there's (big) gaps between the columns.
I have some code where I let users make columns visible or not. What I do when they make a column visible, is add the column with a very high X value (so it shows as the most right column on the datawindow). Since it's a grid, the datawindow will automatically adjust it to the correct x value after making the column visible. PFC's will then automatically grab the correct values when I close the window.
Hope it's any good,
regards