Bixby Sayz Posted November 26, 2011 Share Posted November 26, 2011 Freddy, If I run this in Scar the TPanel takes on the color of the Form. Setting the panel's color only changes its border color. Running this script in Simba the color works as expected: Setting the color changes the color of the entire panel. program New; var MainForm: TForm; LeftPanel: TPanel; procedure InitForm; begin // MainFomr := CreateForm; MainForm := TForm.Create(nil); // Both SCAR/Simba compatible with MainForm do begin ClientWidth := 500; ClientHeight := 500; Caption := 'Form Test'; BorderStyle := bsDialog; Position := poScreenCenter; end; LeftPanel := TPanel.Create(MainForm); with LeftPanel do begin Parent := MainForm; ClientWidth := 150; Align := alLeft; Color := clBlack; end; end; procedure SafeInitForm; var V: TVariantArray; begin SetArrayLength(V, 0); ThreadSafeCall('InitForm', V); end; procedure ShowFormModal; begin MainForm.ShowModal; end; procedure SafeShowFormModal; var V: TVariantArray; begin SetArrayLength(V, 0); ThreadSafeCall('ShowFormModal', V); end; begin SafeInitForm; SafeShowFormModal; end. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 26, 2011 Share Posted November 26, 2011 You need to set the panel's "ParentBackground" property to False: program New; var MainForm: TForm; LeftPanel: TPanel; procedure InitForm; begin // MainFomr := CreateForm; MainForm := TForm.Create(nil); // Both SCAR/Simba compatible with MainForm do begin ClientWidth := 500; ClientHeight := 500; Caption := 'Form Test'; BorderStyle := bsDialog; Position := poScreenCenter; end; LeftPanel := TPanel.Create(MainForm); with LeftPanel do begin Parent := MainForm; ClientWidth := 150; Align := alLeft; Color := clBlack; ParentBackground := False; end; end; procedure SafeInitForm; var V: TVariantArray; begin SetArrayLength(V, 0); ThreadSafeCall('InitForm', V); end; procedure ShowFormModal; begin MainForm.ShowModal; end; procedure SafeShowFormModal; var V: TVariantArray; begin SetArrayLength(V, 0); ThreadSafeCall('ShowFormModal', V); end; begin SafeInitForm; SafeShowFormModal; end. However, you should make sure you use CreateForm for SCAR unless you plan on freeing the form yourself, because else you'll create a huge memoryleak. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 26, 2011 Author Share Posted November 26, 2011 You need to set the panel's "ParentBackground" property to False:Ah Ha! Knew I was missing something simple. However, you should make sure you use CreateForm for SCAR unless you plan on freeing the form yourself, because else you'll create a huge memoryleak.Yeah, I generally do. Changed it that one time just so I could compile & run in Simba to see how it behaved there. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 26, 2011 Share Posted November 26, 2011 (edited) You should consider using SCAR's form designer for this, it lets you visually design the forum, which usually prevents this kind of problems, as in this case for example ParentBackground would be set to False automatically when you change the panel's color and it will also output a very clean script/include file for you to use Edited November 26, 2011 by Freddy Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 27, 2011 Author Share Posted November 27, 2011 But where is the fun in that? And that would mean admitting I didn't notice there was a forms designer. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 27, 2011 Share Posted November 27, 2011 Heh, it's one of the most powerful tools in SCAR Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 27, 2011 Author Share Posted November 27, 2011 Very nice tool. But how do I get the .dfm file into my script. as usual I suspect I'm overlooking something blindingly obvious. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 27, 2011 Share Posted November 27, 2011 At the bottom, press Code, the select the options you want at the top and press "Export To SCAR". Quote Link to comment Share on other sites More sharing options...