Re: [WIN] copy SIMPLE combo box selection into clipboard
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET> Oct 23, 2000
- 431 views
Matt, anyone, I tried using your second suggestion, after finding "EM_SETSEL", which I think is needed to cause text to be "selected" so it can be copied to clipboard, but I couldn't make it work. Here's what I found about "selecting" text to copy to clipboard, don't really know from where 'cause I couldn't find it again except in a file I saved: "The EM_SETSEL message selects a range of characters in an edit control. You can send this message to either an edit control or a rich edit control." Here's what I tried, maybe you can see what I've done wrong? <code snippet follows> global procedure W32RoutinesCombo_onChange () integer dummy -- writes the text from selected item in combo box into "hidden" edit control: -- (this *works*, at *least* when hidden edit is visible) wPuts(HiddenEditLine, getItem(W32RoutinesCombo, getIndex(W32RoutinesCombo))) -- selects *all* the text in the hidden edit control? -- (I don't see any "selection" occur in the visible "hidden" edit control) -- (tried other start/end values too, no result; 0,-1 is supposed to be "select all") dummy = sendMessage(HiddenEditLine,EM_SETSEL,0,-1) -- copies selected(?) text in hidden edit control to clipboard: -- (but it doesn't, because "paste" doesn't paste what was in hidden edit!) copy(HiddenEditLine) -- sets focus back to real editor: setFocus(mle) end procedure onChange[W32RoutinesCombo] = routine_id("W32RoutinesCombo_onChange") <code snippet ends> Any ideas?? Dan ----- Original Message ----- From: "Matt Lewis" <matthewwalkerlewis at YAHOO.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Sunday, October 22, 2000 12:35 PM Subject: Re: [WIN] copy SIMPLE combo box selection into clipboard > --- Dan B Moyer <DANMOYER at PRODIGY.NET> wrote: > > Whoops, > > I should have said, (how) can I get an item selected in a SIMPLE combo box > > copied into the clipboard? > > > > You probably need to use the clipboard functions defined in user32.dll: > > OpenClipboard, SetClipboardData, CloseClipboard, EmptyClipboard: > > BOOL OpenClipboard( HWND hWndNewOwner // handle to window opening > clipboard); > BOOL CloseClipboard(VOID) > HANDLE SetClipboardData( UINT uFormat, // clipboard format > HANDLE hMem // data handle); > BOOL EmptyClipboard(VOID) > > Alternatively, you could create a hidden edit control, set the text to whatever > is selected in the combo, and use the win32lib copy() routine on the edit > control. > > > > ===== > Matt Lewis > http://www.realftp.com/matthewlewis > > __________________________________________________ > Do You Yahoo!? > Yahoo! Messenger - Talk while you surf! It's FREE. > http://im.yahoo.com/