[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [PATCH 1/2] Make InputSequenceEntry friendly to embedding in w
From: |
Vaclav Slavik |
Subject: |
Re: [lmi] [PATCH 1/2] Make InputSequenceEntry friendly to embedding in wxDVC. |
Date: |
Wed, 13 Jul 2011 18:55:55 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
Hi,
On 2011-07-05 15:11, Vaclav Slavik wrote:
> Please replace this with an updated version:
>
> commit 2806dea06f88c781fcf304beb6e22e6f1b752074
> Author: Vaclav Slavik <address@hidden>
> Date: Fri Apr 29 10:26:53 2011 +0200
>
> Make InputSequenceEntry friendly to embedding in wxDVC.
I'm sorry that I keep updating this, but here's another patch
(to be applied on top of the previous one) that makes the code cleaner.
It's functionally equivalent, but as Vadim pointed out,
TranferDataFromWindow() is the right and official way to do this.
Thanks,
Vaclav
commit b9a4f101bf1f1b825c4ccff887d7a3028a0e7d53
Author: Vaclav Slavik <address@hidden>
Date: Wed Jul 13 18:47:05 2011 +0200
Use TransferDataFromWindow() to get data from InputSequenceEditor.
This is much cleaner than the EndModal() hack.
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
old mode 100755
new mode 100644
index c27dd2c..ac56bb2
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -198,7 +198,7 @@ class InputSequenceEditor
void sequence(InputSequence const& s);
std::string sequence_string();
- virtual void EndModal(int retCode);
+ virtual bool TransferDataFromWindow();
private:
void add_row();
@@ -1012,14 +1012,17 @@ void InputSequenceEditor::UponAddRow(wxCommandEvent&
event)
duration_num_field(new_row).SetFocus();
}
-void InputSequenceEditor::EndModal(int retCode)
+bool InputSequenceEditor::TransferDataFromWindow()
{
+ if(!wxDialog::TransferDataFromWindow())
+ return false;
+
// We need to set the value as soon as possible -- when used in
wxDataViewCtrl, the value
// is read from editor control as soon as focus changes, which is before
ShowModal() returns.
- if(associated_text_ctrl_ && retCode == wxID_OK)
+ if(associated_text_ctrl_)
associated_text_ctrl_->SetValue(sequence_string());
- wxDialog::EndModal(retCode);
+ return true;
}
class InputSequenceTextCtrl