Ejemplo n.º 1
0
void frmMain::OnChildFocus(wxChildFocusEvent &event)
{
	// Grab the focussed control and stash it away for later use
	currentControl = dynamic_cast<wxControl *>(event.GetEventObject());

	// Setup the menu controls according to the control that's selected
	// and it's status.

	// Defaults.
	editMenu->Enable(MNU_COPY, false);

	// ctlSQLBox?
	ctlSQLBox *sb = dynamic_cast<ctlSQLBox *>(event.GetEventObject());
	if (sb)
	{
		// Copy
		editMenu->Enable(MNU_COPY, !sb->GetSelectedText().IsEmpty());
	}

	// Listview?
	ctlListView *lv = dynamic_cast<ctlListView *>(event.GetEventObject());
	if (lv)
	{
		// Copy
		editMenu->Enable(MNU_COPY, lv->GetSelectedItemCount() > 0);
	}
}
Ejemplo n.º 2
0
void MvcController::UponChildFocus(wxChildFocusEvent& event)
{
    event.Skip();

    wxWindow* new_focused_window = FindFocus();

    // A wxChildFocusEvent is sent for every window in the hierarchy,
    // from new_focused_window up to this MvcController. Ignore all
    // but the "deepest" one--see:
    //   http://lists.nongnu.org/archive/html/lmi/2009-01/msg00001.html
    if(event.GetWindow() != new_focused_window)
        {
        return;
        }

    // Do nothing if focus hasn't changed. This case arises when
    // another application is activated, and then this application
    // is reactivated.
    if(last_focused_window_ == new_focused_window)
        {
        return;
        }

    if
        (  wxID_CANCEL == new_focused_window->GetId()
        || wxID_HELP   == new_focused_window->GetId()
        )
        {
        return;
        }

    if(Validate())
        {
        if(new_focused_window)
            {
            last_focused_window_ = new_focused_window;
            }
        else
            {
            warning() << "Keyboard focus was lost." << LMI_FLUSH;
            RefocusLastFocusedWindow();
            }
        }
    else
        {
        LMI_ASSERT(!unit_test_refocus_event_pending_);
        if(!unit_test_under_way_)
            {
            wxCommandEvent event0(wxEVT_REFOCUS_INVALID_CONTROL);
            wxPostEvent(this, event0);
            }
        unit_test_refocus_event_pending_ = true;
        }
}
Ejemplo n.º 3
0
void TextFrame::onChildFocus(wxChildFocusEvent& event)
{
    if(event.GetWindow()==_mainText)
    {
        _currentText = _mainText;
    }
    else if(event.GetWindow()==_secondText)
    {
        _currentText = _secondText;
    }
}
Ejemplo n.º 4
0
void DiffPanel::OnChildFocus(wxChildFocusEvent& event) {
	EditorCtrl* focused = (EditorCtrl*)event.GetWindow();
	if (focused != m_currentEditor) {
		if (focused == m_leftEditor) m_currentEditor = m_leftEditor;
		else if (focused == m_rightEditor) m_currentEditor = m_rightEditor;
		m_parentFrame->UpdateNotebook();
	}
}
Ejemplo n.º 5
0
void CToolDlg::OnChildFocus(wxChildFocusEvent& event)
{
	if(m_ignore_event_functions)return;
	if(event.GetWindow())
	{
		SetPicture();
	}
}
Ejemplo n.º 6
0
	void OnFocus(wxChildFocusEvent& evt)
	{
		CmdProc* p1=wm.cmdptr.GetData();
		CmdProc* p2=m_pActiveView? &m_pActiveView->Target:NULL;
		if(p1!=p2)
		{
			wm.cmdptr.SetData(p2);
			wm.wup.gp_add("CmdProc");
		}
		evt.Skip(true);
	}
Ejemplo n.º 7
0
	void OnFocus(wxChildFocusEvent& evt)
	{
		CmdProc* p1=WndManager::current().cmdptr.GetData();
		CmdProc* p2=NULL;
		if(p1!=p2)
		{
			WndManager::current().cmdptr.SetData(p2);
			WndUpdator::current().gp_add("CmdProc");
		}
		evt.Skip(true);
	}
Ejemplo n.º 8
0
void mmNewAcctDialog::changeFocus(wxChildFocusEvent& event)
{
    wxWindow *w = event.GetWindow();
    int oject_in_focus = 0;
    if ( w )
        oject_in_focus = w->GetId();

    if (oject_in_focus == ID_DIALOG_NEWACCT_TEXTCTRL_ACCESSINFO)
    {
        wxTextCtrl* textCtrl = (wxTextCtrl*)FindWindow(ID_DIALOG_NEWACCT_TEXTCTRL_ACCESSINFO);
        textCtrl->SetValue(m_accessInfo);
        m_accessChanged = true;
    }

    if (m_notesCtrl->GetValue() == m_notesLabel)
    {
        m_notesCtrl->SetValue("");
    }
}
Ejemplo n.º 9
0
void mmStockDialog::onFocusChange(wxChildFocusEvent& event)
{
    updateControls();
    event.Skip();
}
Ejemplo n.º 10
0
void mmAssetDialog::changeFocus(wxChildFocusEvent& event)
{
    wxWindow *w = event.GetWindow();
    if (w) assetRichText = (w->GetId() == IDC_NOTES ? true : false);
}
Ejemplo n.º 11
0
void DialogStyleEditor::OnChildFocus(wxChildFocusEvent &event) {
	UpdateWorkStyle();
	SubsPreview->SetStyle(*work);
	event.Skip();
}
Ejemplo n.º 12
0
void myTextCtrl::OnSetChildFocus(wxChildFocusEvent& event)
{
	VRenderFrame *vrf = (VRenderFrame *)m_frame;
	if (vrf) vrf->SetKeyLock(true);
	event.Skip();
}
Ejemplo n.º 13
0
void mmTransDialog::onFocusChange(wxChildFocusEvent& event)
{
    wxWindow *w = event.GetWindow();
    if (w)
        object_in_focus_ = w->GetId();

    m_currency = Model_Currency::GetBaseCurrency();
    wxString accountName = cbAccount_->GetValue();
    wxString toAccountName = cbPayee_->GetValue();
    for (const auto& acc : Model_Account::instance().all_checking_account_names()){
        if (acc.CmpNoCase(accountName) == 0) accountName = acc;
        if (acc.CmpNoCase(toAccountName) == 0) toAccountName = acc;
    }

    const Model_Account::Data* account = Model_Account::instance().get(accountName);
    if (account)
    {
        m_currency = Model_Account::currency(account);
        cbAccount_->SetValue(account->ACCOUNTNAME);
        m_trx_data.ACCOUNTID = account->ACCOUNTID;
    }

    if (!m_transfer)
    {
        Model_Payee::Data * payee = Model_Payee::instance().get(cbPayee_->GetValue());
        if (payee) 
        {
            cbPayee_->ChangeValue(payee->PAYEENAME);
            setCategoryForPayee(payee);
        }
        toTextAmount_->ChangeValue("");
    }
    else
    {
        const Model_Account::Data* to_account = Model_Account::instance().get(toAccountName);
        if (to_account)
        {
            m_to_currency = Model_Account::currency(to_account);
            cbPayee_->ChangeValue(to_account->ACCOUNTNAME);
            m_trx_data.TOACCOUNTID = to_account->ACCOUNTID;
        }
    }

    if (object_in_focus_ == textAmount_->GetId())
        textAmount_->SelectAll();
    else 
    {
        if (textAmount_->Calculate()) 
            textAmount_->GetDouble(m_trx_data.TRANSAMOUNT);
        skip_amount_init_ = false;
    }

    if (m_advanced && object_in_focus_ == toTextAmount_->GetId())
        toTextAmount_->SelectAll();
    else 
    {
        if (toTextAmount_->Calculate())
            toTextAmount_->GetDouble(m_trx_data.TOTRANSAMOUNT);
    }

    dataToControls();
    event.Skip();
}