RRUZ / vcl-styles-utils

Extend and improve the Delphi VCL Styles
https://theroadtodelphi.wordpress.com/
331 stars 114 forks source link

C++ Vcl.Styles.NC example #240

Closed bdwilton closed 5 years ago

bdwilton commented 5 years ago

Hello,

I was just trying to test the latest code in 10.3.1 and translate the Delphi example to C++.

NCControls := TNCControls.Create(Self); //Set the image list NCControls.Images := ImageList1; //Add a NC Button NCControls.Controls.AddEx; //Set the style of the button NCControls[0].GetAs.Style := nsSplitButton; //Set the style of the image

Just seem to be getting a bit stuck with the template parts.

ncCtrl_ = new TNCControls(FormMain);
ncCtrl_->Images = ImageListHD;
ncCtrl_->Controls->AddEx<TNCButton>();
ncCtrl_->operator[](0)->GetAs<TNCButton>().Caption = "hello";
bdwilton commented 5 years ago

Forgot to say I'm getting link errors as follows

[ilink32 Error] Error: Unresolved external 'Vcl::Styles::Nc::TNCButton fastcall Vcl::Styles::Nc::TListNCControls::AddEx()' referenced from D:\ENVIEW\WIN32\DEBUG\DCP\FRMMAIN.OBJ [ilink32 Error] Error: Unresolved external 'Vcl::Styles::Nc::TNCButton fastcall Vcl::Styles::Nc::TNCControl::GetAs()' referenced from D:\ENVIEW\WIN32\DEBUG\DCP\FRMMAIN.OBJ [ilink32 Error] Error: Unresolved external 'Vcl::Styles::Nc::TNCButton::{1173}...' referenced from D:\ENVIEW\WIN32\DEBUG\DCP\FRMMAIN.OBJ [ilink32 Error] Error: Unable to perform link

I'm not using runtime link and bcc32c

bdwilton commented 5 years ago

Got it linking but just can't get any of the generics to link so wrote an AddButton function to just return the button from the AddEx function e.g. returns a TNCButton.

Not sure why the AddEx generics wont match when linking.

I've tried both 10.1.2 and 10.3.1 with the same results

bdwilton commented 5 years ago

Thought I got it working but not so far through AddEx