Page 1 of 1

Dynamic columns

PostPosted: Wed Feb 20, 2008 1:40 am
by ILYA
Hi! I try to create dynamic columns in my table by the following code:

Code: Select all
If sType = 'STRING'
   Set nColID = SalTblCreateColumnEx( hWndItem, 1, 2, sCaption, nLength, DT_String )
Else If  sType = 'DATE'
   Set nColID = SalTblCreateColumnEx( hWndItem, 1, 2, sCaption, nLength, DT_DateTime )
   Call SalFmtSetFormat( SalNumberToWindowHandle( nColID ), FMT_Format_Date )
   Call SalFmtSetInputMask( SalNumberToWindowHandle( nColID ), 'dd/mm/yyyy' )

But I can't set date format for the column with DT_DateTime. By default the value in the cell displays as '01-JAN-08', but I want '01/01/2008'. The function SalFmtSetFormat/SalFmtSetInputMask doesn't work. Is it a bug or I do smth wrong?

TD 5.1 & Windows Vista Business

Re: Dynamic columns

PostPosted: Thu Feb 21, 2008 7:32 am
by ILYA
One more bug:
Code: Select all
...
Set nColID = SalTblCreateColumnEx( hWndItem, 1, 2, 'Dynamic column', 100, DT_LongString )
..

I try to create column DT_LongString datatype. The program runs, but I don't see the column! After call SalTblCreateColumnEx nColID = -1, that indicates an error. But I need DT_LongString column, cause I populate an Oracle function return result into it. Is it possible to create a LongString column?

Re: Dynamic columns

PostPosted: Thu Feb 21, 2008 9:16 am
by Jeff Luther
First, Ilya, you can see in TD help what column types are allowed:
nDatatype Number. One of the constants DT_String, DT_Number, or DT_DateTime. Any other value will cause an error.


If you need a Long String then you will need to add one in design-time for your TW (or fetch into a var. of type Long String, then assign that to your string TW column).

Second, your use of hWndItem as the first parameter is suspect to me, esp. since I cannot see where your SAL code is placed. If it is inside a msg. sent to the TW then it is ok; if it is somewhere else, be careful! since hWndItem refers to the curent *object* with the focus and that could be anywhere: pushbutton, field with the focus, etc.

I think it is better, when showing a little SAL code like you have, to provide us the context of the code; namely, in a function, msg., etc.

Re: Dynamic columns

PostPosted: Fri Feb 22, 2008 8:57 am
by niels
ILYA wrote:
Code: Select all
   Call SalFmtSetInputMask( SalNumberToWindowHandle( nColID ), 'dd/mm/yyyy' )

But I can't set date format for the column with DT_DateTime. By default the value in the cell displays as '01-JAN-08', but I want '01/01/2008'. The function SalFmtSetFormat/SalFmtSetInputMask doesn't work. Is it a bug or I do smth wrong?

In earlier versions of TD "mm" is used for minutes and "MM" is used for months. Try changing the format to 'dd/MM/yyyy' and see if it helps.

EDIT: That should be SalFmtSetFormat () instead of SalFmtSetInputMask().

Re: Dynamic columns

PostPosted: Mon Mar 24, 2008 3:11 am
by ILYA
I still can't set date format in table column. The code is:
Code: Select all
Set nColID = SalTblCreateColumnEx( hWndItem, 1, 2, 'Dynamic date column', 20, DT_DateTime)
Set hCol = SalTblGetColumnWindow( hWndItem, nColID, COL_GetID )
Call SalFmtSetFormat( hCol, FMT_Date_DMY )
Call SalTblPopulate(hWndItem, hSqlMain, lsStmt, TBL_FillAll)

Is it possible to set format of the dynamic column?

Re: Dynamic columns

PostPosted: Thu Mar 27, 2008 9:38 am
by jmgemperle
Hi,

I blieve there is couple issues there... need to check further and come back to you ASAP.

JM

Re: Dynamic columns

PostPosted: Thu Nov 19, 2015 4:01 am
by FRBhote
So is there a solution to this?