2. Re: Question about Win32lib's EditText control
George,
Thanks for asking, these make good candidates for my "Templates" program!
They're not implemented as actual defaults, they have to be created.
Drag'n'drop I'm not sure about, but for right-click copy options, do
something like this:
-- create right click popups:
constant
EditPopup = create( Popup, "", Window1, 0, 0, 0, 0, 0 ),
PopUp_Undo = create( MenuItem, "Undo", EditPopup, 0, 0, 0, 0, 0 ),
PopUp_Sep1 = create( MenuItem, "-", EditPopup, 0, 0, 0, 0, 0 ),
PopUp_Cut = create( MenuItem, "Cut", EditPopup, 0, 0, 0, 0, 0 ),
PopUp_Copy = create( MenuItem, "Copy", EditPopup, 0, 0, 0, 0, 0 ),
PopUp_Paste = create( MenuItem, "Paste", EditPopup, 0, 0, 0, 0, 0 )
-- create Edit procedures to respond with:
-- (respond to clicks in right-click pop-up, or in regular top menu)
-
procedure onClick_MenuUndo()
-- undo
undo( MleText6 )
end procedure
onClick[ MenuUndo ] = routine_id( "onClick_MenuUndo" )
onClick[ PopUp_Undo ] = routine_id( "onClick_MenuUndo" )
-
procedure onClick_MenuCut()
-- cut
cut( MleText6 )
setEnable( MenuUndo, 1 )
end procedure
onClick[ MenuCut ] = routine_id( "onClick_MenuCut" )
onClick[ PopUp_Cut ] = routine_id( "onClick_MenuCut" )
-
procedure onClick_MenuCopy()
-- copy
copy( MleText6 )
setEnable( MenuUndo, 1 )
end procedure
onClick[ MenuCopy ] = routine_id( "onClick_MenuCopy" )
onClick[ PopUp_Copy ] = routine_id( "onClick_MenuCopy" )
-
procedure onClick_MenuPaste()
-- paste
paste( MleText6 )
setEnable( MenuUndo, 1 )
end procedure
onClick[ MenuPaste ] = routine_id( "onClick_MenuPaste" )
onClick[ PopUp_Paste ] = routine_id( "onClick_MenuPaste" )
-
procedure onClick_MenuDelete()
-- clear
clear( MleText6 )
setEnable( MenuUndo, 1 )
end procedure
onClick[ MenuDelete ] = routine_id( "onClick_MenuDelete" )
-- procedure to respond to right click:
-- (with the setEnables you can set which are active or not)
procedure onMouse_Mle( integer event, integer x, integer y, integer shift )
sequence MousePosition
MousePosition = getMouseRelPos(Window1)-- had used MleText6
if event = RightDown then
setEnable( PopUp_Cut, 1 )
setEnable( PopUp_Copy, 1 )
setEnable( PopUp_Paste, 1 )
setEnable( PopUp_Undo, 1 )
popup( EditPopup, MousePosition[1],MousePosition[2] )
end if
end procedure
onMouse[MleText6] = routine_id("onMouse_Mle")
Hope this helps,
Dan Moyer
----- Original Message -----
From: "George Papadopoulos" <georgp at otenet.gr>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, October 02, 2001 2:26 PM
Subject: Question about Win32lib's EditText control
Hi EU-ZE(I)N
Why when i right click in an EditText control doesn't appears the
default systems's context menu? (Undo..Cut..Copy..etc)
Is it a bug?
This also happens with Combo but not with ComboEx or MleText control.
Is there any way to work Drag n' Drop in a Combo with default style?
3. Re: Question about Win32lib's EditText control
George,
Here's a better demo, 'cause after I sent the other, I wan't *sure* it would
work with single line edit, after all!
Dan Moyer
<tested code follows:>
-- code generated by Win32Lib IDE v0.10.5
-- then hand modified
include Win32Lib.ew
without warning
----
-- Window Window1
global constant Window1 = create( Window, "Window1", 0, Default, Default,
400, 300, 0 )
global constant EditText2 = create( EditText, "EditText2", Window1, 20, 36,
256, 40, 0 )
-- create right click popups:
constant
EditPopup = create( Popup, "", Window1, 0, 0, 0, 0, 0 ),
PopUp_Undo = create( MenuItem, "Undo", EditPopup, 0, 0, 0, 0, 0 ),
PopUp_Sep1 = create( MenuItem, "-", EditPopup, 0, 0, 0, 0, 0 ),
PopUp_Cut = create( MenuItem, "Cut", EditPopup, 0, 0, 0, 0, 0 ),
PopUp_Copy = create( MenuItem, "Copy", EditPopup, 0, 0, 0, 0, 0 ),
PopUp_Paste = create( MenuItem, "Paste", EditPopup, 0, 0, 0, 0, 0 )
procedure onClick_MenuUndo()
-- undo
undo(EditText2 )
end procedure
--onClick[ MenuUndo ] = routine_id( "onClick_MenuUndo" )
onClick[ PopUp_Undo ] = routine_id( "onClick_MenuUndo" )
procedure onClick_MenuCut()
-- cut
cut(EditText2 )
--setEnable( MenuUndo, 1 )
end procedure
--onClick[ MenuCut ] = routine_id( "onClick_MenuCut" )
onClick[ PopUp_Cut ] = routine_id( "onClick_MenuCut" )
procedure onClick_MenuCopy()
-- copy
copy(EditText2 )
--setEnable( MenuUndo, 1 )
end procedure
--onClick[ MenuCopy ] = routine_id( "onClick_MenuCopy" )
onClick[ PopUp_Copy ] = routine_id( "onClick_MenuCopy" )
procedure onClick_MenuPaste()
-- paste
paste(EditText2 )
--setEnable( MenuUndo, 1 )
end procedure
--onClick[ MenuPaste ] = routine_id( "onClick_MenuPaste" )
onClick[ PopUp_Paste ] = routine_id( "onClick_MenuPaste" )
procedure onClick_MenuDelete()
-- clear
clear(EditText2 )
--setEnable( MenuUndo, 1 )
end procedure
--onClick[ MenuDelete ] = routine_id( "onClick_MenuDelete" )
-- procedure to respond to right click in edit box:
-- (with the setEnables you can set which are active or not)
procedure onMouse_EditText2( integer event, integer x, integer y, integer
shift )
sequence MousePosition
MousePosition = getMouseRelPos(Window1)-- had usedEditText2
if event = RightDown then
setEnable( PopUp_Cut, 1 )
setEnable( PopUp_Copy, 1 )
setEnable( PopUp_Paste, 1 )
setEnable( PopUp_Undo, 1 )
popup( EditPopup, MousePosition[1],MousePosition[2] )
end if
end procedure
onMouse[EditText2] = routine_id("onMouse_EditText2")
WinMain( Window1, Normal )
----- Original Message -----
From: "George Papadopoulos" <georgp at otenet.gr>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, October 02, 2001 2:26 PM
Subject: Question about Win32lib's EditText control
Hi EU-ZE(I)N
Why when i right click in an EditText control doesn't appears the
default systems's context menu? (Undo..Cut..Copy..etc)
Is it a bug?
This also happens with Combo but not with ComboEx or MleText control.
Is there any way to work Drag n' Drop in a Combo with default style?
5. Re: Question about Win32lib's EditText control
Here is what the Microsoft SDK documentation says about this issue...
-------------------------
Platform SDK: Windows User Interface
Cut, Copy, Paste, and Clear Operations
There are four messages for moving text between an edit control and the
clipboard. The WM_COPY message copies the current selection (if any) from an
edit control to the clipboard without deleting it from the edit control. The
WM_CUT message deletes the current selection (if any) in the edit control
and copies the deleted text to the clipboard. The WM_CLEAR message deletes
the current selection (if any) from an edit control, but does not copy it to
the clipboard (unless the user pressed the SHIFT key). The WM_PASTE message
copies text from the clipboard into an edit control at the insertion point.
These four messages apply to both single-line and multiline edit controls.
Windows NT 4.0 and later:
An edit control includes a built-in context menu that makes it easy for the
user to move text between the edit control and the clipboard. The context
menu appears when the user right-clicks the control. The commands in the
context menu include Undo, Cut, Copy, Paste, Delete, and Select All.
-------------------------
----- Original Message -----
From: "George Papadopoulos" <georgp at otenet.gr>
To: "EUforum" <EUforum at topica.com>
Sent: Friday, October 05, 2001 6:20 AM
Subject: Question about Win32lib's EditText control
Don
Thanks for your answer, your code works fine and has the advantage
to add more commands, but i still don't understand why Windows don't
appear their default context meny. It's not programmable (Win32API
says). Win32lib's creators maybe have an answer to this.
George
EU-ZEIN <-- ( It's greek, means "Good living")
6. Re: Question about Win32lib's EditText control
George,
there is a line of code in the win32lib.ew file that is preventing Windows
from "seeing" the right mouse down event. Look for a line that looks like
this ...
lRC = {kReturnNow}
in the function fDoMouse().
If you comment out this line, the automatic context menu is restored. I
don't know why this line of code is in the library. I'm sure that either
David Cuny or Matt Lewis put this functionality there for a good reason, so
I hope this "fix" doesn't break something else.
----- Original Message -----
From: "George Papadopoulos" <georgp at otenet.gr>
To: "EUforum" <EUforum at topica.com>
Sent: Friday, October 05, 2001 6:20 AM
Subject: Question about Win32lib's EditText control
Don
Thanks for your answer, your code works fine and has the advantage
to add more commands, but i still don't understand why Windows don't
appear their default context meny. It's not programmable (Win32API
says). Win32lib's creators maybe have an answer to this.
George
EU-ZEIN <-- ( It's greek, means "Good living")