diff --git a/reference/DropFiles/main.cpp b/reference/DropFiles/main.cpp index 69bb1d360..260e4c1c6 100644 --- a/reference/DropFiles/main.cpp +++ b/reference/DropFiles/main.cpp @@ -5,7 +5,7 @@ using namespace Upp; struct DndTest : public TopWindow { virtual void Paint(Draw &w); virtual void DragAndDrop(Point p, PasteClip& d); - + virtual bool Key(dword key, int count); Vector files; DndTest(); @@ -29,6 +29,16 @@ void DndTest::DragAndDrop(Point p, PasteClip& d) } } +bool DndTest::Key(dword key, int count) +{ + if(key == K_CTRL_V) { + files = GetFiles(Ctrl::Clipboard()); + Refresh(); + return true; + } + return false; +} + DndTest::DndTest() { Title("I need files!"); diff --git a/reference/Events/Events.cpp b/reference/Events/Events.cpp index edcfe1a86..104ae7b9a 100644 --- a/reference/Events/Events.cpp +++ b/reference/Events/Events.cpp @@ -2,6 +2,14 @@ using namespace Upp; +String GetKeyDescEx(int key) +{ + String desc = GetKeyDesc(key & ~K_KEYUP); + if(key & K_KEYUP) + desc << " UP"; + return desc; +} + struct App : TopWindow { ArrayCtrl log; @@ -164,13 +172,7 @@ struct App : TopWindow { virtual bool Key(dword key, int count) { - Log(Format("Key(%x, %d) ", (int)key, count) + GetKeyDesc(key)); - return false; - } - - virtual bool WKey(dword key, int count) - { - Log(Format("WKey(%x, %d) ", (int)key, count) + GetKeyDesc(key)); + Log(Format("Key(%x, %d) ", (int)key, count) + GetKeyDescEx(key)); return false; } @@ -186,7 +188,7 @@ struct App : TopWindow { virtual bool HotKey(dword key) { - Log(Format("HotKey(%x) ", (int)key) + GetKeyDesc(key)); + Log(Format("HotKey(%x) ", (int)key) + GetKeyDescEx(key)); return false; } diff --git a/reference/Events/Events.upp b/reference/Events/Events.upp index 9fc1112e2..4879becb5 100644 --- a/reference/Events/Events.upp +++ b/reference/Events/Events.upp @@ -1,4 +1,4 @@ -description "Demonstration of basic input events"; +description "Demonstration of basic input events\377"; uses CtrlLib; diff --git a/reference/Events/init b/reference/Events/init new file mode 100644 index 000000000..1f51e8f88 --- /dev/null +++ b/reference/Events/init @@ -0,0 +1,4 @@ +#ifndef _Events_icpp_init_stub +#define _Events_icpp_init_stub +#include "CtrlLib/init" +#endif