WinSendMsg(WinWindowFromID(hwnd, DD_FILESRCH),
EM_SETTEXTLIMIT,
MPFROMSHORT( 512 ),
(MPARAM)0);
Now I can enter up to 512 characters. But when selecting one of the longer
entries in the drop down box, only the first 256 chars plus a few garbage
characters are copied to entry field.
Is there an internal clipboard I've to widen too?
Regards,
Andreas
Hi Andi,
> WinSendMsg(WinWindowFromID(hwnd, DD_FILESRCH),
> EM_SETTEXTLIMIT,
> MPFROMSHORT( 512 ),
> (MPARAM)0);
> Now I can enter up to 512 characters. But when selecting one of the longer
> entries in the drop down box, only the first 256 chars plus a few garbage
> characters are copied to entry field.
>
> Is there an internal clipboard I've to widen too?
Not a clipboard, per se. A combo box contains two child windows - an
entry-field and a listbox with the ids
#define CBID_EDIT 0x029B
#define CBID_LIST 0x029A
Offhand I would look for buffer sizing issues in your code. It's not
impossible that listbox entries are limited to 256 characters, but if
so, this is not documented TTBOMK.
Steven
--
---------------------------------------------------------------------
Steven Levine <ste...@earthlink.bogus.net>
eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com
---------------------------------------------------------------------
Hm, reading the PM reference, it seems that EM_SETTEXTLIMIT is not the
correct way to deal with this.
EM_SETTEXTLIMIT sets a limit when you enter something in the entryfield
and NOT when something is copied from the listbox to the entryfield. In
other words: EM_SETTEXTLIMIT limits on "user entry" but not on "Software
generated entry".
I'd try WM_SETWINDOWPARAMS on the entry field:
ENTRYFDATA e={0};
WNDPARAMS p={0};
e.cb = 8; // length of ENTRYFDATA structure
e.cchEditLimit = 512; // text length limit for the edit box
e.ichMinSel = 0; // no text currently selected, cursor before 1.
character
e.ichMaxSel = 0; // no text currently selected, cursor before 1.
character
p.fsStatus = WPM_CTLDATA;
p.cbCtlData = sizeof(e);
p.pCtlData = &e;
WinSendWindowMsg(WinWindowFromID(hwnd,DD_FILESRCH),
WM_SETWINDOWPARAMS,
MPFROMP(&p),
MPVOID);
Instead of setting this during runtime via WM_SETWINDOWPARAMS, you can
also set this in the resource file (if the combobox is defined in a
resource file) or on Window creation (if you create the window via
WinCreateWindow).
The Entryfield associated with the drop down uses the ENTRYFDATA
structure for its control data. The resource directive CTLDATA does the
trick. It allows to set 2-byte values. You can directly set the
ENTRYFDATA parameters from within the resource file:
COMBOBOX "",DD_FILESRCH,10,10,200,20
CTLDATA 8,512,0,0
This will set the ENTRYFDATA structure like this:
e.cb = 8;
e.cchEditLimit = 512;
e.ichMinSel = 0;
e.ichMaxSel = 0;
Lars
Hm, reading the PM reference, it seems that EM_SETTEXTLIMIT is not the
correct way to deal with this.
EM_SETTEXTLIMIT sets a limit when you enter something in the entryfield
and NOT when something is copied from the listbox to the entryfield. In
other words: EM_SETTEXTLIMIT limits on "user entry" but not on "Software
generated entry".
I'd try WM_SETWINDOWPARAMS on the entry field:
ENTRYFDATA e={0};
WNDPARAMS p={0};
e.cb = sizeof(e); // length of ENTRYFDATA structure
e.cchEditLimit = 512; // text length limit for the edit box
e.ichMinSel = 0; // no text currently selected, cursor before 1.
character
e.ichMaxSel = 0; // no text currently selected, cursor before 1.
character
p.fsStatus = WPM_CTLDATA;
p.cbCtlData = sizeof(e);
p.pCtlData = &e;
WinSendWindowMsg(WinWindowFromID(hwnd,DD_FILESRCH),
WM_SETWINDOWPARAMS,
MPFROMP(&p),
MPVOID);
Instead of setting this during runtime via WM_SETWINDOWPARAMS, you can
also set this in the resource file (if the combobox is defined in a
resource file) or on Window creation (if you create the window via
WinCreateWindow).
The Entryfield associated with the drop down uses the ENTRYFDATA
structure for its control data. The resource directive CTLDATA does the
trick. It allows to set 2-byte values. You can directly set the
ENTRYFDATA parameters from within the resource file:
COMBOBOX "",DD_FILESRCH,10,10,200,20
CTLDATA 8,512,0,0
This will set the ENTRYFDATA structure like this:
e.cb = 8; // (sizeof(ENTRYFDATA))
Stepping over in IDEBUG starting from CBN_ENTER message I see only pmmerge code.
What I found out is, the ENTRYFIELDS in this application are subclassed. But I
do not see any problem with text length in the replacement routine -
MRESULT EXPENTRY newEfProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
if ( (msg == WM_PRESPARAMCHANGED) && ((ULONG)mp1 == PP_FONTNAMESIZE) &&
!(g.state & IS_RESETBOXFONTS) )
{
WinSendMsg(WinParent(WinParent(hwnd)),
SWM_PPCHANGED, (MPARAM)hwnd, MPTRUE);
return MRFALSE;
} /* endif */
return g.pDefEfProc(hwnd, msg, mp1, mp2);
}
Andi
if ( SHORT2FROMMP(mp1) == CBN_ENTER )
{
int i;
char sBuf[512];
i = WinQueryLboxSelectedItem(WinWindowFromID(hwnd,DD_FILESRCH) );
if (i != LIT_NONE )
{
WinQueryLboxItemText( WinWindowFromID(hwnd,DD_FILESRCH), i, sBuf,
sizeof(sBuf) );
WinSetWindowText( WinWindowFromID(hwnd,DD_FILESRCH), sBuf );
}
}
Only draw back I've found till now is - selecting an entry with up/down keys and
closing the list box with the arrow does not generate the CBN_ENTER message. But
the selecting itself copies the crippled text to the entry field. But this is a
minor issue in my case.
Andi