Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Sharing styles across forms


This question is answered.


Permlink Replies: 3 - Last Post: May 31, 2016 9:21 PM Last Post By: Linden ROTH
Michael Leahy

Posts: 239
Registered: 5/9/07
Sharing styles across forms  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 17, 2016 1:51 PM
Delphi XE7 FireUI

I have a TListBox which holds TMyCustomListBoxItems that use styles from StyleBook1 on the form.

If I copy and paste the TListBox (making a new TListBox) on the same form, my TMyCustomListBoxItems use the style just like the original TListBox.

If I copy the TListBox and paste it into a different form, the TListBoxItems do not use the StyleBook1.
In TCandidateListBoxItem.ApplyStyle() the call to FindStyleResource('mycustomstyle') returns nil.

I tried copying the StyleBook1 from the original form to the new form. Same issue.

I don't understand what "connects" TMyCustomListBoxItems to the Stylebook1.

Why would FindStyleResource('mycustomstyle') work on one form but not on another form?
John Kouraklis

Posts: 209
Registered: 3/10/01
Re: Sharing styles across forms  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 30, 2016 10:10 AM   in response to: Michael Leahy in response to: Michael Leahy
Michael Leahy wrote:
Delphi XE7 FireUI

I don't understand what "connects" TMyCustomListBoxItems to the Stylebook1.

What connects them is the stylebook property of the form.

Assign it to the Stylebook1

Michael Leahy

Posts: 239
Registered: 5/9/07
Re: Sharing styles across forms  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 31, 2016 6:05 PM   in response to: John Kouraklis in response to: John Kouraklis
John Kour wrote:
Michael Leahy wrote:
Delphi XE7 FireUI

I don't understand what "connects" TMyCustomListBoxItems to the Stylebook1.

What connects them is the stylebook property of the form.

Assign it to the Stylebook1


The form with the Stylebook1 on it does have its property set to Stylebook1.

On the other form however, when I click on the form's StyleBook property it won't let me set it to anything.
Linden ROTH

Posts: 467
Registered: 11/3/11
Re: Sharing styles across forms
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 31, 2016 9:21 PM   in response to: Michael Leahy in response to: Michael Leahy
Michael Leahy wrote:

The form with the Stylebook1 on it does have its property set to Stylebook1.

On the other form however, when I click on the form's StyleBook property it won't let me set it to anything.

Add your StyleBook form to the uses list of the second form (or put the StyleBook on a DM or similar)

object Form15: TForm15
  Left = 0
  Top = 0
  Caption = 'Form15'
  StyleBook = Form12.StyleBook1

--
Linden
"Mango" was Cool but "Wasabi" was Hotter but remember it's all in the "source"
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02