Search found 192 matches

by alys666
Sun Jun 30, 2019 2:20 pm
Forum: C++ Development
Topic: Check if wxString Contains Alphabetic Characters Only
Replies: 6
Views: 177

Re: Check if wxString Contains Alphabetic Characters Only

if you need speed, just scan the string with custom function isAlphaChar(..) regular expressions are slow bool isAlphaChar(char fch){ return (fch >='a' && fch <='z') || (fch>='A' && fch<='Z'); } bool isAlphaString(const wxString &fs){ for(int i=0; i<fs.Length(); ++i){ if(!isAlphaChar(fs[i])) return ...
by alys666
Sun Jun 30, 2019 2:13 pm
Forum: C++ Development
Topic: wxStyledTextCtrl: Get Text Encoding Type
Replies: 4
Views: 91

Re: wxStyledTextCtrl: Get Text Encoding Type

functions SetCodePage / GetCodePage.
quite good guide for wxWidgets scintilla control comes with its port to Python - wxPython.
http://proton-ce.sourceforge.net/rc/sci ... dex-2.html
by alys666
Fri Jun 28, 2019 8:34 pm
Forum: C++ Development
Topic: wxAuiNotebook: Possible to get index of non-selected tab?
Replies: 4
Views: 121

Re: wxAuiNotebook: Possible to get index of non-selected tab?

imo, you must handle mouse event wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN
by alys666
Fri Jun 28, 2019 2:08 pm
Forum: C++ Development
Topic: wxProcess troubles
Replies: 1
Views: 86

Re: wxProcess troubles

question closed... i just run wxExecute in problem2, with not complete command string i forget to add additional parameters to commandline.:) app started wrong and pipe was broken by the way code of wxProcess::Open looks strange why they set Pid if wxExecute must do it? at least it's not mentioned i...
by alys666
Fri Jun 28, 2019 7:50 am
Forum: C++ Development
Topic: wxProcess troubles
Replies: 1
Views: 86

wxProcess troubles

(ubuntu 16.04) Goal: I need to run external app, get its stdin/stdout, and be signaled if process finished. docs say - it's wxProcess class. there are two ways to be signaled - 1. redefine method OnTerminate(..) of wxProcess and give instance of this class to wxExecute(..). 2. catcht wxProcessEvent ...
by alys666
Thu Jun 27, 2019 7:14 am
Forum: C++ Development
Topic: Resizing windows wxFrame
Replies: 4
Views: 162

Re: Resizing windows wxFrame

yes. read about wxSizer. and/or wxAuiManager. sizer is an invisible "container" for windows, inserted in him, and he also can be inserted in another sizer. if sizer changes his size, he changes size of windows, he contains, according to strategy given at particular window addition to this sizer. etc...
by alys666
Wed Jun 26, 2019 6:07 pm
Forum: C++ Development
Topic: How to move files around in zip archive
Replies: 2
Views: 109

Re: How to move files around in zip archive

1. according to given link, in PutNextEntry(file), the file - is a file path. not just a name. so write a path there. 2. if you need to check an equality of wxStrings, better to use equality opearator: someString=="Some String", not someString.Matches("Some String"). function Matches - it's for file...
by alys666
Mon Jun 24, 2019 9:31 pm
Forum: C++ Development
Topic: Threaded Job/Queue Manager getting stuck?
Replies: 8
Views: 240

Re: Threaded Job/Queue Manager getting stuck?

The key take away for events crossing thread boundaries is when sending non-scalar data (anything larger than an int) that data needs to be an independent copy of the data, and not (for example) just a wxString assigned with SetString(). The correct way to set an event's string that is going to be ...
by alys666
Mon Jun 24, 2019 7:32 pm
Forum: C++ Development
Topic: Char Array Is Getting Corrupted
Replies: 16
Views: 418

Re: Char Array Is Getting Corrupted

I think that is what the user over in cplusplus.com forums is trying to tell me, that I need to call delete[] objectData; in the constructor to prevent memory leaks: ResourceObject::ResourceObject(unsigned char* data, unsigned int data_size) { if (objectData) { delete[] objectData; objectData = NUL...
by alys666
Mon Jun 24, 2019 2:44 pm
Forum: C++ Development
Topic: How to attach some user data to wxWindow?
Replies: 5
Views: 155

Re: How to attach some user data to wxWindow?

Hi, You shouldn't pass anything GUI-related to a secondary thread. Passing it there will imply usage and you can't use it inside the thread. ;-) Thank you. it's wrong. I can pass to secondary thread address of destination wxEventHandler and send him async events. it's how async messaging works in w...
by alys666
Mon Jun 24, 2019 10:59 am
Forum: C++ Development
Topic: Char Array Is Getting Corrupted
Replies: 16
Views: 418

Re: Char Array Is Getting Corrupted

If you can use std::vector<> - use std::vector<> . You write on C++ so you shouldn't avoid simple stuff just because you can do it. std:vector is a common container with access by index, which can be iterated via formal iterators, an can shrink and grow. it is used as part of high level algorithms ...
by alys666
Mon Jun 24, 2019 5:31 am
Forum: C++ Development
Topic: Char Array Is Getting Corrupted
Replies: 16
Views: 418

Re: Char Array Is Getting Corrupted

objectData = new unsigned char[data_size]; But it still didn't work. Let me know if I misunderstood you. yes. it's how you must implement this place, and don't use std::vector. uint8 *_data = new uint8[datasize]; memcpy(_data, ext_data, datasize); ... delete[] _data; ... if it is "not working", the...
by alys666
Sun Jun 23, 2019 6:03 pm
Forum: C++ Development
Topic: Char Array Is Getting Corrupted
Replies: 16
Views: 418

Re: Char Array Is Getting Corrupted

memcpy cannot copy only one byte.. if you didn't give 1 byte as size to copy.
in your case std::vector is excessive.
better to take an array by new[size], copy there, and do not forget to delete it by delete[].
by alys666
Sat Jun 22, 2019 8:47 pm
Forum: C++ Development
Topic: How to wxIsKindOf class check for a wxTextEntry derived classes?
Replies: 8
Views: 226

Re: How to wxIsKindOf class check for a wxTextEntry derived classes?

That is exactly what came to my mind, using like: bool wxHasTextEntry(const wxWindow *pWindow); and wxTextEntry *wxGetTextEntry(const wxWindow *pWindow); What I am struggling about is what kinda cast should I use!? wxDynamicCast or wxStaticCast ? TIA. you can use static_cast<SomeType *> if you are ...
by alys666
Sat Jun 22, 2019 8:48 am
Forum: C++ Development
Topic: How to attach some user data to wxWindow?
Replies: 5
Views: 155

Re: How to attach some user data to wxWindow?

i thought about mixing, but then i cannot give to secondary threads generic reference to custom classes instances as wxWindow*.
And i also thought about temporary name correction, kinda prefix it with '!'.