Specifying attachments properties fails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Specifying attachments properties fails

ipstools.project
Hi all,

The text below is from documentation. The only difference is that the method #createText: is replaced by #createScrolledText: . After this change debugger popups saying he does not understand the  "leftAttachment".

At the same time description of this method states that "This resource is valid only when the receiver's parent is a CwForm." which is OK in my case.
Can somebody explain why this doesn`t work and propose the working example for scroled text? And thank you in advance.

| shell form drawing text |
 
shell := CwTopLevelShell
   createApplicationShell: 'shell'
   argBlock: [:w | w title: 'Form Example'].
 
form := shell
   createForm: 'form'
   argBlock: nil.
form manageChild.
 
drawing := form
   createDrawingArea: 'drawing'
   argBlock: [:w |
      w
         borderWidth: 1;
         width: 200;
         height: 200;
         leftAttachment: XmATTACHFORM;
         leftOffset: 2;
         rightAttachment: XmATTACHPOSITION;
         rightPosition: 67;
         topAttachment: XmATTACHFORM;
         topOffset: 2;
         bottomAttachment: XmATTACHFORM;
         bottomOffset: 2].
drawing manageChild.
 
text := form
   createScrolledText
: 'text'
   argBlock: [:w |
      w
         leftAttachment: XmATTACHWIDGET;
         leftWidget: drawing;
         leftOffset: 2;
         rightAttachment: XmATTACHFORM;
         rightOffset: 2;
         topAttachment: XmATTACHFORM;
         topOffset: 2;
         bottomAttachment: XmATTACHFORM;
         bottomOffset: 2].
text manageChild.
shell realizeWidget.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Specifying attachments properties fails

Seth Berman
Hello,

I think this concept comes from the original Motif specification, but a ScrolledText is really a ScrolledWindow composite which manages/decorates a Text.  It is the scrolled window that has the attachments to the form...not the text. 
Therefore in your modified example, the 'w' is a CwText...for attachment manipulation you want it's parent, the CwScrolledWindow, since that is the thing attached to the form.

Change '[:w | w leftAttachment.......'  to   '[:w | w parent leftAttachment........'

-- Seth  

On Wednesday, February 8, 2017 at 5:35:07 PM UTC-5, [hidden email] wrote:
Hi all,

The text below is from documentation. The only difference is that the method #createText: is replaced by #createScrolledText: . After this change debugger popups saying he does not understand the  "leftAttachment".

At the same time description of this method states that "This resource is valid only when the receiver's parent is a CwForm." which is OK in my case.
Can somebody explain why this doesn`t work and propose the working example for scroled text? And thank you in advance.

| shell form drawing text |
 
shell := CwTopLevelShell
   createApplicationShell: 'shell'
   argBlock: [:w | w title: 'Form Example'].
 
form := shell
   createForm: 'form'
   argBlock: nil.
form manageChild.
 
drawing := form
   createDrawingArea: 'drawing'
   argBlock: [:w |
      w
         borderWidth: 1;
         width: 200;
         height: 200;
         leftAttachment: XmATTACHFORM;
         leftOffset: 2;
         rightAttachment: XmATTACHPOSITION;
         rightPosition: 67;
         topAttachment: XmATTACHFORM;
         topOffset: 2;
         bottomAttachment: XmATTACHFORM;
         bottomOffset: 2].
drawing manageChild.
 
text := form
   createScrolledText
: 'text'
   argBlock: [:w |
      w
         leftAttachment: XmATTACHWIDGET;
         leftWidget: drawing;
         leftOffset: 2;
         rightAttachment: XmATTACHFORM;
         rightOffset: 2;
         topAttachment: XmATTACHFORM;
         topOffset: 2;
         bottomAttachment: XmATTACHFORM;
         bottomOffset: 2].
text manageChild.
shell realizeWidget.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Specifying attachments properties fails

ipstools.project

Hi Seth,

this worked for me perfectly and the explanation is very clean.
Thank you very much.

Sergei.

четверг, 9 февраля 2017 г., 2:36:52 UTC+3 пользователь Seth Berman написал:
Hello,

I think this concept comes from the original Motif specification, but a ScrolledText is really a ScrolledWindow composite which manages/decorates a Text.  It is the scrolled window that has the attachments to the form...not the text. 
Therefore in your modified example, the 'w' is a CwText...for attachment manipulation you want it's parent, the CwScrolledWindow, since that is the thing attached to the form.

Change '[:w | w leftAttachment.......'  to   '[:w | w parent leftAttachment........'

-- Seth  

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Specifying attachments properties fails

Seth Berman
My pleasure to help Sergei, glad it worked.

On Thursday, February 9, 2017 at 6:43:24 AM UTC-5, [hidden email] wrote:

Hi Seth,

this worked for me perfectly and the explanation is very clean.
Thank you very much.

Sergei.

четверг, 9 февраля 2017 г., 2:36:52 UTC+3 пользователь Seth Berman написал:
Hello,

I think this concept comes from the original Motif specification, but a ScrolledText is really a ScrolledWindow composite which manages/decorates a Text.  It is the scrolled window that has the attachments to the form...not the text. 
Therefore in your modified example, the 'w' is a CwText...for attachment manipulation you want it's parent, the CwScrolledWindow, since that is the thing attached to the form.

Change '[:w | w leftAttachment.......'  to   '[:w | w parent leftAttachment........'

-- Seth  

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.