Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-05

Carbon and TMemo/TEdit

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Damien Gerard

I have in my app a TScrollBox (AutoScroll=True) with some controls created by hand as follow :

E := TEdit.Create(nil);
E.Parent := MyScrollBox;
[...]

Works fine under GTK2/Win32. However with Carbon TEdit and TMemo don't have a border and they are not properly drawn when scrolling in the TScrollBox.

I try to make a new and simple app to reproduce it but using the IDE to create controls (Lazarus with the Carbon Widgetset) and all works well, at runtime such as designtime (except the control selects the whole text then deselect it when you click on it).

Would the parameter `nil` (in `TEdit.Create(nil)`) be a problem with the Carbon WidgetSet ?

Thanks.

Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email

Tom Gregorovic
to Damien Gerard
Damien Gerard wrote 20 lines
I have in my app a TScrollBox (AutoScroll=True) with some controls created by hand as follow : E := TEdit.Create(nil); E.Parent := MyScrollBox; [...] Works fine under GTK2/Win32. However with Carbon TEdit and TMemo don't have a border and they are not properly drawn when scrolling in the TScrollBox. I try to make a new and simple app to reproduce it but using the IDE to create controls (Lazarus with the Carbon Widgetset) and all works well, at runtime such as designtime (except the control selects the whole text then deselect it when you click on it). Would the parameter `nil` (in `TEdit.Create(nil)`) be a problem with the Carbon WidgetSet ?

Hi,
I think the problem is in adjusting client area of TScrollBox after its content changes. I deal with this so long and have been not able to solve it so far.

Tom

Reply by email

Damien Gerard
to Tom Gregorovic

Le May 30, 2008 ? 1:18 PM, Tom Gregorovic a ?crit :

Show quoted text 29 lines
On Fri, May 30, 2008 at 10:47 AM, Damien Gerard wrote: > > I have in my app a TScrollBox (AutoScroll=True) with some controls > created by hand as follow : > > E := TEdit.Create(nil); > E.Parent := MyScrollBox; > [...] > > Works fine under GTK2/Win32. However with Carbon TEdit and TMemo > don't > have a border and they are not properly drawn when scrolling in the > TScrollBox. > > I try to make a new and simple app to reproduce it but using the IDE > to create controls (Lazarus with the Carbon Widgetset) and all works > well, at runtime such as designtime (except the control selects the > whole text then deselect it when you click on it). > > Would the parameter `nil` (in `TEdit.Create(nil)`) be a problem with > the Carbon WidgetSet ? > Hi, I think the problem is in adjusting client area of TScrollBox after its content changes. I deal with this so long and have been not able to solve it so far.

I forgot I am using anchors with those components. I just try, and Indeed it is related with the use of anchors

Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email

JoshyFun
to Damien Gerard: I have in my app a TScrollBox (AutoScroll=True) with some controls created by hand as…

Hello Damien,

Friday, May 30, 2008, 10:47:57 AM, you wrote:

DG> I have in my app a TScrollBox (AutoScroll=True) with some controls DG> created by hand as follow :
DG> E := TEdit.Create(nil);
DG> E.Parent := MyScrollBox;
DG> [...]
DG> Works fine under GTK2/Win32. However with Carbon TEdit and TMemo don't DG> have a border and they are not properly drawn when scrolling in the DG> TScrollBox.

I do not have any kind of experience with Carbon, but controls to be used inside another objects should be added using InsertControl, do not ? Maybe I'm completly wrong... as usual :)

Best regards, JoshyFun

Reply by email

Damien Gerard
to JoshyFun

Le May 30, 2008 ? 4:05 PM, JoshyFun a ?crit :

Show quoted text 18 lines
Hello Damien, Friday, May 30, 2008, 10:47:57 AM, you wrote: DG> I have in my app a TScrollBox (AutoScroll=True) with some controls DG> created by hand as follow : DG> E := TEdit.Create(nil); DG> E.Parent := MyScrollBox; DG> [...] DG> Works fine under GTK2/Win32. However with Carbon TEdit and TMemo don't DG> have a border and they are not properly drawn when scrolling in the DG> TScrollBox. I do not have any kind of experience with Carbon, but controls to be used inside another objects should be added using InsertControl, do not ? Maybe I'm completly wrong... as usual :)
It seems it is useless.
 From procedure TControl.SetParent(NewParent: TWinControl);
you can find this :
if NewParent  nil then NewParent.InsertControl(Self);
Consequently E.Parent := <Something>  should be enough.
I don't think actually InsertControl should be used.
Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email

Mattias Gaertner
to Damien Gerard
Show quoted text 31 lines
Le May 30, 2008 ? 4:05 PM, JoshyFun a ?crit : > Hello Damien, > > Friday, May 30, 2008, 10:47:57 AM, you wrote: > > DG> I have in my app a TScrollBox (AutoScroll=True) with some > DG> controls created by hand as follow : > DG> E := TEdit.Create(nil); > DG> E.Parent := MyScrollBox; > DG> [...] > DG> Works fine under GTK2/Win32. However with Carbon TEdit and > DG> TMemo > don't > DG> have a border and they are not properly drawn when scrolling > DG> in > the > DG> TScrollBox. > > I do not have any kind of experience with Carbon, but controls to be > used inside another objects should be added using InsertControl, do > not ? Maybe I'm completly wrong... as usual :) It seems it is useless. From procedure TControl.SetParent(NewParent: TWinControl); you can find this : if NewParent nil then NewParent.InsertControl(Self); Consequently E.Parent := <Something> should be enough. I don't think actually InsertControl should be used.

Assigning 'Parent' is the normal way.

Mattias

Reply by email