Search found 133 matches

by apoorv569
Thu Mar 04, 2021 3:29 pm
Forum: C++ Development
Topic: Assigning keyboard shortcuts to controls.
Replies: 2
Views: 33

Re: Assigning keyboard shortcuts to controls.

Hi, How do you handle accelerators? Where did you set them up - in the frame/dialog class or somewhere else? Show the code of the frame itself and how do you handle them. Thank you. All the code above is in a class that inherits from wxPanel, which is the main panel of wxFrame. After doing some deb...
by apoorv569
Thu Mar 04, 2021 11:50 am
Forum: C++ Development
Topic: Assigning keyboard shortcuts to controls.
Replies: 2
Views: 33

Assigning keyboard shortcuts to controls.

I want to bind some controls like buttons and all to keyboard shortcuts for my application, I found the "Keyboard" sample provided with wxWidgets source, which led me to - https://docs.wxwidgets.org/3.0/classwx_accelerator_table.html#a7c7fd90b4c8197da20334c9c34665121 I setup the accelerator entries ...
by apoorv569
Thu Mar 04, 2021 10:20 am
Forum: C++ Development
Topic: Advice on using the new keyword.
Replies: 4
Views: 46

Advice on using the new keyword.

I was talking to my friend yesterday, I shared my project with him that I'm making with wxWidgets, he said that I'm using the "new" keyword alot, i.e for most controls, and not deleting them and not indenting them inside try catch block or using "new (std::nothrow)", as "new" can throw exception on ...
by apoorv569
Tue Mar 02, 2021 12:38 pm
Forum: C++ Development
Topic: Setting custom font for the application.
Replies: 4
Views: 117

Re: Setting custom font for the application.

This worked, but the font only changes for everything except wxDirCtrl for some reason. It's possible that it doesn't work for all underlying native controls. The SetFont() takes wxFont type as parameter, is it possible to change font based on font name like "comic sans" ? No. You need create a wxF...
by apoorv569
Tue Mar 02, 2021 4:10 am
Forum: C++ Development
Topic: Setting custom font for the application.
Replies: 4
Views: 117

Re: Setting custom font for the application.

If you set a custom font to a wxFrame or wxDialog before adding any controls, all controls added later should inherit that font. This worked, but the font only changes for everything except wxDirCtrl for some reason. The SetFont() takes wxFont type as parameter, is it possible to change font based ...
by apoorv569
Sat Feb 27, 2021 6:41 am
Forum: C++ Development
Topic: Setting custom font for the application.
Replies: 4
Views: 117

Setting custom font for the application.

Is there a way to set a custom font for the entire application, i.e all control, buttons, checkboxes, wxListCtrl, and all that, or do I have to set font manually for each control in the application, by calling `SetFont()` for that control?
by apoorv569
Fri Feb 26, 2021 10:41 pm
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

You cannot comment out that, as I have written several times, this is the line that makes dragging work with wxDVC on GTK. event.SetDataObject(data); // wxDropSource dragSource(this); // dragSource.SetData(*data); And this part is the one I wrote was useless for wxDVC and should be removed. I see, ...
by apoorv569
Fri Feb 26, 2021 9:17 pm
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

Once I added event.SetDataObject(data), I did not observe any difference for dragging the item out of wxDVLC when I removed the wxDropSource code from the wxEVT_DATAVIEW_ITEM_BEGIN_DRAG handler. But I guess you need it for some reason. If I comment out event.SetDataObject(data); it will not let me ...
by apoorv569
Fri Feb 26, 2021 6:11 pm
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

IMO, this is not true, the major difference in the event handler which makes the dragging work is this event.SetDataObject(data); Unlike wxDropSource, wxDataViewEvent expects a pointer to wxDataObject, i.e., the object must be allocated on heap and its ownership given to wxDataViewEvent. I see, tha...
by apoorv569
Fri Feb 26, 2021 5:50 pm
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

However, as I wrote before, I do not know how to obtain the result of the drop, or if it is even possible. BTW, you do not need to quote my whole post when it is just above the one having it quoted and fully quoting it does not add any useful information. I looked at the code you shared above, I pa...
by apoorv569
Fri Feb 26, 2021 4:11 pm
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

I know nothing about Linux and, as I wrote above, I am not familiar with wxDVC. Nevertheless, I tried on Ubuntu 20.04 with wxWidgets 3.1.4 (GTK 3.24) under VirtualBox. As you wrote, when I started dragging, nothing happened. When I added m_list->EnableDragSource(wxDF_FILENAME); after constructing m...
by apoorv569
Fri Feb 26, 2021 2:20 pm
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

It seems that you have a toggle column for column 0, so you should use column 1 to get the dragged file name const wxString draggedPath = m_list->GetTextValue(m_list->ItemToRow(event.GetItem()), 1); Additionally, please run my code unmodified and see if it works for you. In other words, copy and pa...
by apoorv569
Fri Feb 26, 2021 1:57 pm
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

(EDITED) I do not know what issue do you have? Does the event handler not get called? Do you have trouble getting the file name to drag? Dragging fails? This looks suspicious to me, as there may be a problem with character encoding: wxString selection = SampleListView->GetTextValue(selectedRow, 1);...
by apoorv569
Fri Feb 26, 2021 12:54 pm
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

FWIW, it works as expected for me on Win10 with wxWidgets recentish GIT master: #include <wx/wx.h> #include <wx/dirctrl.h> #include <wx/dnd.h> #include <wx/stdpaths.h> class MyFrame : public wxFrame { public: MyFrame() : wxFrame(nullptr, wxID_ANY, "Test") { wxBoxSizer* mainSizer = new wxBoxSizer(wx...
by apoorv569
Fri Feb 26, 2021 7:30 am
Forum: C++ Development
Topic: Drag and drop files outside of application.
Replies: 19
Views: 337

Re: Drag and drop files outside of application.

Yes, the "dnd" sample does this. If I understand correctly according to the dnd sample, I copied this code, I bind my wxDirCtrl as, Bind(wxEVT_TREE_BEGIN_DRAG, &Browser::OnBeginDrag, this, BCID_DirCtrl); And I created a function OnBeginDrag as, void Browser::OnBeginDrag(wxTreeEvent& event) { wxFile...