c++builder

What happened to TBitBtn and TButton inheritance chain?

吃可爱长大的小学妹 提交于 2019-12-07 07:05:16
问题 I've recently began to upgrade my RAD Studio 2007 project to RAD Studio 2009. One thing I noticed is when seemingly simple code all of a sudden failed to compile. Example Code: class CButtonPopupMenu { // Snip public: void Init( TButton* SrcButton ) { SrcButton->OnClick = OnButtonClick; } private: void __fastcall OnButtonClick( TObject* Sender ) { // Do some button click stuff } }; // Snip TButton button = new TButton( this ); TBitBtn bitBtn = new TBitBtn( this ); CButtonPopupMenu popupButton

Destructors and inheritance in C++?

人盡茶涼 提交于 2019-12-07 05:43:56
问题 I use Borland C++ Builder. And i had o problem #include <Classes.hpp> class TMyObject : public TObject { __fastcall TMyObject(); __fastcall ~TMyObject();//I would like to inherite my destructor from TObject }; __fastcall TMyObject::TMyObject() : TObject()//it will inherited my constructor from TObject { } And for that new destructor that will inherite ~TObject ? __fastcall TMyObject::~TMyObject????????????? 回答1: This can be solved at TObject 's level. Its destructor has to be virtual:

Numeric edit control with flat button inside and no calculator

雨燕双飞 提交于 2019-12-06 22:38:29
I'm writing a C++ project with RAD Studio, but this also applies to Delphi. I need an edit control where user can only enter floats (2 decimal places) and can restore the original value (taken from a variable, not important here) clilcking on a button (actullay an icon) inside the edit control itself. This is what I've done, using a TJvCalcEdit from JEDI library. Control definition: object Sconto1: TJvCalcEdit [non-important attributes...] ButtonFlat = True Glyph.Data = { D6020000424DD6020000000000003600000028000000100000000E0000000100

Handle runtime change of DPI (text size) on Windows 10

我怕爱的太早我们不能终老 提交于 2019-12-06 21:41:25
问题 On Windows 10, the system no longer requires restart (logoff/logon) to change DPI (text size). My application is not ready for such a runtime change. How does system inform an application that the DPI is changing? What message should I handle? I'm using C++ Builder, so I'm looking for a pure WinAPI solution, no WinForms. 回答1: As @TLama and @DalijaPrasnikar commented, the message to handle is WM_DPICHANGED. #define WM_DPICHANGED 0x02E0 The message is available since Windows 8.1, where it is

FindNextFile fails on 64-bit Windows?

久未见 提交于 2019-12-06 19:28:00
问题 using C++Builder 2007, the FindFirstFile and FindNextFile functions doesn't seem to be able to find some files on 64-bit versions of Vista and XP. My test application is 32-bit. If I use them to iterate through the folder C:\Windows\System32\Drivers they only find a handful of files although there are 185 when I issue a dir command in a command prompt. Using the same example code lists all files fine on a 32-bit version of XP. Here is a small example program: int main(int argc, char* argv[])

Linking fails [ilink32 Error] Fatal: Unable to open file 'TYPES.OBJ'

。_饼干妹妹 提交于 2019-12-06 16:29:35
问题 I have been updating code fomr an old legacy project build using C++ Builder 2010 to compile with C++ Builder 10 Seattle . I have mostly had to change paths, a lot of dupIgnore to TDuplicates::dupIgnore , reimport some components like MSXML and MSMQ etc. First for a bunch of subprojects that the main project uses in the form of bpl's and dll's and finally the code of the main project compiles. But... it fails a linking :P [ilink32 Error] Fatal: Unable to open file 'TYPES.OBJ' I have tried to

Implement IDropTarget

点点圈 提交于 2019-12-06 16:06:58
I would like to drag and drop files from windows explorer onto my application which is being built in Codegear RAD studio 2009. Then I would like to be able to access data from the object I am dragging and dropping. I believe I have to implement IDropTarget. Can someone please provide an example of how I might implement IDropTarget to achieve this? There is a nice example written by Michael Dunn over at codeproject.com which shows how to implement IDropTarget and access data from inside a IDataObject which is used to store data during the drag and drop operation. 来源: https://stackoverflow.com

Android JNI bridge Toast C++ not working - How to fix it?

偶尔善良 提交于 2019-12-06 15:33:16
I'm trying to solve a little problem with my hpp unit. I found some examples on the internet showing how to Toast an information on screen with an Android JNI bridge, but it was just in pascal (delphi), so I decided to use the same pas file but with it an hpp file for conversion. Till now I got it: #ifndef Android_Jni_ToastHPP #define Android_Jni_ToastHPP #pragma delphiheader begin #pragma option push #pragma option -w- // All warnings off #pragma option -Vx // Zero-length empty class member #pragma pack(push,8) #include <FMX.Helpers.Android.hpp> // Pascal unit #include <Androidapi.JNIBridge

Drag and drop images in C++ Builder 6

只愿长相守 提交于 2019-12-06 15:31:00
I'm making a Puzzle program and I now how to move the picture parts with navigation keys but how do I do that using mouse ? I've tried using this but picture is acting like crazy Image1->Top=Mouse->CursorPos.x; Image1->Left=Mouse->CursorPos.y; Any help? Edit: I put this in Timer but Image started blinking in two places at once... int difference_x=Form1->Image1->Left - Mouse->CursorPos.x; int difference_y=Form1->Image1->Top - Mouse->CursorPos.y; int xxx=Mouse->CursorPos.x - difference_x ; int yyy=Mouse->CursorPos.y - 26 - difference_y; // 26 is Cursor height Image1->Top=yyy; Image1->Left=xxx; I

how to write a function Click() for dynamic created button?

旧街凉风 提交于 2019-12-06 15:18:39
问题 Trying to write a simple VCL program for educating purposes (dynamicly created forms, controls etc). Have such a sample code: void __fastcall TForm1::Button1Click(TObject *Sender) { TForm* formQuiz = new TForm(this); formQuiz->BorderIcons = TBorderIcons() << biSystemMenu >> biMinimize >> biMaximize; formQuiz->Position = TPosition::poDesktopCenter; formQuiz->Width = 250; formQuiz->Height = 250; formQuiz->Visible = true; TButton* btnDecToBin = new TButton(formQuiz); btnDecToBin->Parent =