c++builder

array of TRectangles in FMX

痞子三分冷 提交于 2019-12-12 10:20:45
问题 I am trying to extend the code from this from using one TRectangle to using multiple rectangles that can be added at runtime. In that example the code to click on and drag applies only to that one TRectangle Rectangle1 . I need to make it more general so it works on any recangle I add to the form (the rectangles won't be there at design time). I found this code to create a custom class and it works fine to create new rectangles. I can assign methods that run when they are clicked on but i

WebSocket connect to TIdHTTPServer, handshake issue

怎甘沉沦 提交于 2019-12-12 10:03:23
问题 I'm using C++Builder 10.1 Berlin to write a simple WebSocket server application, which listens on a port for some commands sent from a web browser, like Google Chrome. On my Form, I have a TMemo, TButton and TIdHTTPServer, and I have this code: void __fastcall TForm1::Button1Click(TObject *Sender) { IdHTTPServer1->Bindings->DefaultPort = 55555; IdHTTPServer1->Active = true; } void __fastcall TForm1::IdHTTPServer1Connect(TIdContext *AContext) { Memo1->Lines->Add(AContext->Binding->PeerIP);

Can't get Windows Overlay icons to work in TListView

自闭症网瘾萝莉.ら 提交于 2019-12-12 05:49:49
问题 Using Borland C++ Builder 2009 I can display overlay icons in a TListView object, using my own TImageList . However I also need this to work with the Windows icons. Showing those icons is not a problem, but I can't get Overlay icons to work (yet). Here's what I do (not complete and code lifted out of a bigger project, but it should illustrate the question properly) : During Init: SHFILEINFO info ; SmallSystemIconsList->Handle = SHGetFileInfo( L"", 0, &info, sizeof(info), SHGFI_ICON | SHGFI

How to use JNI to start JVM in builder C++ application

我的梦境 提交于 2019-12-12 04:46:14
问题 So i need to use jni to call java method. i started with this code : JNIEnv *env1; JavaVM** jvm1; JavaVMInitArgs vm_args1; JavaVMOption options1[1]; options1[0].optionString = "-Djava.class.path=D:\\Java Src\\TestStruct"; //Path to the java source code vm_args1.version = JNI_VERSION_1_6; //JDK version. This indicates version 1.6 vm_args1.nOptions = 1; vm_args1.options = options1; vm_args1.ignoreUnrecognized = 0; int reAt = JNI_CreateJavaVM(jvm1, (void**)&env1, &vm_args1); if(reAt < 0) Label1-

convert unicodestring to string in xrad studio

会有一股神秘感。 提交于 2019-12-12 04:17:24
问题 I have a problem in "Rad Studio 10 Seattle" where I am trying to get text input from a TEdit object and I get a errormessage saying E2034 Cannot convert 'UnicodeString' to 'string' My code is as follows: this->shopVar->addDog(edName->Text, StrToInt(edAge->Text), "male", "dogspecial"); This function addDog takes (string, int, string, string) When I try to send the text from the TEdit object with edName->Text I get the errormessage mentioned earlier. My question is as follows, can i make a

What to do if tgamma() function is not defined?

空扰寡人 提交于 2019-12-12 03:57:15
问题 I am trying to use tgamma() from the standard library. When I try to compile, I get the error message: Call to undefined function tgamma I have the directive #include <cmath> . I use Embarcadero C++ Builder XE3, which claims to support C++11 standards. What could be my problem, and how to fix it? 回答1: Boost contains a tgamma function. #include <boost/math/special_functions/gamma.hpp> ... double rootPi = boost::math::tgamma<double>(0.5); Of course, you can always switch to a different compiler

Delphi/C++Builder TBitmap: How to determinine scanline order?

…衆ロ難τιáo~ 提交于 2019-12-12 03:48:48
问题 Delphi's TBitmap type is basically a wrapper over a GDI BITMAP and PALETTE, and can support both top-down and bottom-up scanline ordering. I have a TBitmap which I need to convert to GDI+ Bitmap, in order to rotate and composite it. My bitmap is 32-bit ARGB, which windows supports, but VCL doesn't natively 'understand'. TBitmap *bmp; ... When I use the following constructor, the alpha channel doesn't work for compositing, but otherwise everything works. Gdiplus::Bitmap b(bmp->Handle, NULL);

DBExpress and mysql last insert id

南笙酒味 提交于 2019-12-12 02:46:55
问题 There are several posts about how to get last_insert_id from MySQL and related issues. I found this one post related to DBExpress: delphi dxExpress MySQL: invalid LAST_INSERT_ID value However, following that post don't help me using the following code to insert a note into a notes table. TSQLQuery* tq = new TSQLQuery(NULL); tq->SQLConnection = atdbDM->SQLConnection1; stringstream q; q <<"INSERT INTO note (created_by, note) VALUES ("<<1234<<", \'<none>\');"; q << "SELECT LAST_INSERT_ID() AS

How can I update data in a chart in execution time (in C++ builder)?

空扰寡人 提交于 2019-12-12 02:44:50
问题 I'm using Borland C++ Builder to create this. The code is very simple because its only purpose, for now, is to help me learn how to use the TChart functions. I'll use what I learn to create a more complex program later. I have a series of numbers that must be shown on a memo box and on a chart. The values in the chart are displayed after the program finishes its exectuion, however, I need the values to be updated in real time - I mean, everytime the program calculates a new number, it must be

How does TThread.Synchronize() work?

为君一笑 提交于 2019-12-12 01:56:57
问题 I tested the following code with the Synchronize() method in C++Builder 2010: while(true) {} CreateDirectory ("D:\\test", NULL); What happened is that the UI freezed, and the folder was not created. Does that means that Synchronize() passes the code to the UI thread to execute it, and then waits until the code is executed before continuing? Edit: I explained wrongly what I have done in my test code. What I have really done is the following: I called Synchronize() with the following code: