1. [WIN] copy SIMPLE combo box selection into clipboard
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET>
Oct 21, 2000
-
Last edited Oct 22, 2000
Whoops,
I should have said, (how) can I get an item selected in a SIMPLE combo box
copied into the clipboard?
The *simple* combo box otherwise works better for me, but because it has a
static
label at the top instead of an edit box (not noticeably, just functionally),
this may be why it doesn't copy from it, but I'd like to if I could.
But even if I try to use the *regular* combo box, what gets copied to the
clip
board is always one selection behind, except for when it first shows the
list (in other words, what I clicked on in the list portion *the time
before* is what gets copied to the clipboard, not what I clicked on *this*
time, except the first time the list shows, in which case the first element
gets auto copied, because I setIndex to 1 when the list portion of the combo
box was populated).
Dan
----- Original Message -----
From: "Dan B Moyer" <DANMOYER at prodigy.net>
To: "Euphoria Mail List" <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, October 21, 2000 8:38 PM
Subject: [WIN] copy combo box selection into clipboard
> How can I get an item selected in a combo box copied into the clipboard?
>
> I tried: "onChange_TheCombo", copy(TheCombo), but that didn't work;
> then I tried: "onChange_TheCombo",
> copy(getItem(TheCombo,getIndex(TheCombo))) but that didn't work either.
>
> Dan Moyer
>
>
2. 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/
3. Re: [WIN] copy SIMPLE combo box selection into clipboard
Matt,
Thanks,
I'm not sure how to use your first suggestion, but I had thought of your
second, but didn't know how to make the text I would put in the hidden edit
*selected*, so the "copy" would work on it; but I accidentally came across
something I'd saved once, mentioning what seemed to be exactly the "command"
I needed to make text in a "range" selected....now if I can just find it
*again*!!
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/
4. Re: [WIN] copy SIMPLE combo box selection into clipboard
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/
5. Re: [WIN] copy SIMPLE combo box selection into clipboard
- Posted by Dan B Moyer <DANMOYER at PRODIGY.NET>
Oct 23, 2000
-
Last edited Oct 24, 2000
Whoops,
Found it, it was easy, just use "setText" to put info into edit control
instead of wPuts it.
Dan
----- Original Message -----
From: "Dan B Moyer" <DANMOYER at prodigy.net>
To: "Euphoria Programming for MS-DOS" <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, October 23, 2000 6:52 PM
Subject: Re: [WIN] copy SIMPLE combo box selection into clipboard
> 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/
>