Quantcast

[FR] Evaluate expressions in Transcript

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[FR] Evaluate expressions in Transcript

panu@nospam.com
FEATURE REQUEST  ([FR]):
It would help if we could directly evaluate an expression that is
printed on the Transcript.

RATIONALE:
Sometimes in my program I might consider doing something like opening a
web-browser for the user. However, that might be too disruptive if it
happens often. Rather, I would like to print on the Transcript an
expression the user can evaluate to open the browser themselves.
Currently if I do that, the user must first copy the expression from the
Transcript, and paste it somewhere else, before they can evaluate it.

On a more general level, it would help if the menus on all text-windows
would be the same, perhaps just having some of the items disabled in
some contexts, if necessary.

Thanks
-Panu Viljamaa


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [FR] Evaluate expressions in Transcript

Chris Uppal-3
[hidden email] wrote:

> It would help if we could directly evaluate an expression that is
> printed on the Transcript.

I hope OA don't accept this request.  Dolphin's transcript used to work that
way (like most other Smalltalks) and I considered it a definitite improvement
when they made the separation between the two functions (a window is either a
transcript or a workspace, never both).


> Sometimes in my program I might consider doing something like opening a
> web-browser for the user. However, that might be too disruptive if it
> happens often. Rather, I would like to print on the Transcript an
> expression the user can evaluate to open the browser themselves.
> Currently if I do that, the user must first copy the expression from the
> Transcript, and paste it somewhere else, before they can evaluate it.

You do realise that you are not allowed to include the transcript in deployed
applicatins, don't you ?  See Redist.txt in the Dolphin installation directory.

Sounds like a pretty unpleasant UI design to me too -- but that obviously
depends on your users.

    -- chris


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Evaluate expressions in Transcript

drozenfa
Chris Uppal wrote:
> [hidden email] wrote:
>
> > It would help if we could directly evaluate an expression that is
> > printed on the Transcript.
>
> I hope OA don't accept this request.  Dolphin's transcript used to work that
> way (like most other Smalltalks) and I considered it a definitite improvement
> when they made the separation between the two functions (a window is either a
> transcript or a workspace, never both).

I agree with Chris on this philosophy.
In my case, I am more concerned about developing time.
When I get a compilation error in the Transcript, for example as a
result of a package importing, I often found myself unconsciously
selecting class name on the Transcript and pressing Ctrl+B to open the
offending code.
Going further, I would also like to have Browse-it open on a certain
method when Ctrl+B pressed on text like MyClass>>method.


Dan


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [FR] Evaluate expressions in Transcript

Support at Object Arts
In reply to this post by Chris Uppal-3
"Chris Uppal" <[hidden email]> wrote in message
news:44f18b45$2$634$[hidden email]...

> [hidden email] wrote:
>
>> It would help if we could directly evaluate an expression that is
>> printed on the Transcript.
>
> I hope OA don't accept this request.  Dolphin's transcript used to work
> that
> way (like most other Smalltalks) and I considered it a definitite
> improvement
> when they made the separation between the two functions (a window is
> either a
> transcript or a workspace, never both).
>
> ....


Don't worry, we will not be changing this. As you say, it is a deliberate
design decision.

Regards

Object Arts


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [FR] Evaluate expressions in Transcript

panu@nospam.com
In reply to this post by Chris Uppal-3
Chris Uppal wrote:
> [hidden email] wrote:
>
>>...Currently if I do that, the user must first copy the expression from the
>> Transcript, and paste it somewhere else, before they can evaluate it.
>
> ...
> Sounds like a pretty unpleasant UI design to me too -- but that obviously
> depends on your users.


Yes, this feature not meant for end-users of my application(s),
(if any), but really for myself, and other Dolphin developers.

I got this idea from some java environments where compilation-
and other error messages are displayed on a transcript -like
window which supports hyperlinks. The error happens in a given
method, whose name then shows up as a *hyperlink* in the transcript.
Clicking on the link takes me directly to the source-code in question.

Dolphin Transcript doesn't support hyperlinks, so the closest thing
to them would be the ability to print evaluable expressions on
the Transcript.

Note that this does mean the Transcript has to become a Workspace,
It can still be kept read-only, if you only enable the operations
'Evaluate', 'Inspect', and 'Browse' on it.

Naturally, hyperlink-support would be very groovy, but probably
much more effort to implement.


-Panu Viljamaa


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [FR] Evaluate expressions in Transcript

Support at Object Arts
<[hidden email]> wrote in message
news:[hidden email]...

>...
>
> I got this idea from some java environments where compilation-
> and other error messages are displayed on a transcript -like
> window which supports hyperlinks. The error happens in a given
> method, whose name then shows up as a *hyperlink* in the transcript.
> Clicking on the link takes me directly to the source-code in question.
>
> Dolphin Transcript doesn't support hyperlinks, so the closest thing
> to them would be the ability to print evaluable expressions on
> the Transcript.
>
> Note that this does mean the Transcript has to become a Workspace,
> It can still be kept read-only, if you only enable the operations
> 'Evaluate', 'Inspect', and 'Browse' on it.
>
> Naturally, hyperlink-support would be very groovy, but probably
> much more effort to implement.
>

Probably not actually....

----------------------
"For DX6"!

NMHDR subclass: #ENLINK
 instanceVariableNames: ''
 classVariableNames: ''
 poolDictionaries: ''
 classInstanceVariableNames: ''!

!ENLINK methodsFor!

chrg
 ^CHARRANGE fromAddress: (bytes yourAddress + 24)!

lParam
 ^(bytes dwordAtOffset: 20) asExternalAddress!

msg
 ^(bytes dwordAtOffset: 12)!

wParam
 ^(bytes dwordAtOffset: 16)! !
!ENLINK categoriesFor: #chrg!**compiled accessors**!public! !
!ENLINK categoriesFor: #lParam!**compiled accessors**!public! !
!ENLINK categoriesFor: #msg!**compiled accessors**!public! !
!ENLINK categoriesFor: #wParam!**compiled accessors**!public! !

!ENLINK class methodsFor!

defineFields
 super defineFields.
 self
  defineField: #msg
   type: DWORDField readOnly
   offset: 12;
  defineField: #wParam
   type: DWORDField readOnly
   offset: 16;
  defineField: #lParam
   type: LPVOIDField readOnly
   offset: 20;
  defineField: #chrg
   type: (StructureField type: CHARRANGE) beReadOnly
   offset: 24.
 self byteSize: 32! !
!ENLINK class categoriesFor: #defineFields!initializing!public! !

RichTextEdit classPool at: 'RtnMap' put: nil!

!RichTextEdit class methodsFor!

initializeNotificationMap
 RtnMap := (IdentityDictionary new)
    at: EN_LINK put: #enLink:;
    at: EN_SELCHANGE put: #enSelChange:;
    shrink;
    yourself! !
!RichTextEdit class categoriesFor: #initializeNotificationMap!private! !

!RichTextEdit methodsFor!

enLink: anExternalAddress
 | struct |
 struct := ENLINK fromAddress: anExternalAddress.
 struct msg == WM_LBUTTONUP
  ifTrue:
   [| range text |
   range := struct chrg.
   text := self plainTextRange: (range cpMin + 1 to: range cpMax).
   self presenter trigger: #linkClicked: with: text].
 ^nil!

enSelChange: anNMHDR
 self invalidateUserInterface!

eventMask
 ^self sendMessage: EM_GETEVENTMASK!

eventMask: anInteger
 self
  sendMessage: EM_SETEVENTMASK
  wParam: 0
  lParam: anInteger!

eventMask: anInteger set: aBoolean
 self eventMask: (self eventMask mask: anInteger set: aBoolean)!

isUrlDetectionEnabled
 ^(self sendMessage: EM_GETAUTOURLDETECT) asBoolean!

isUrlDetectionEnabled: aBoolean
 self sendMessage: EM_AUTOURLDETECT wParam: aBoolean asParameter.
 self eventMask: ENM_LINK set: aBoolean!

nmNotify: pNMHDR
 ^(RtnMap at: (pNMHDR sdwordAtOffset: 8) ifAbsent: [])
  ifNil: [super nmNotify: pNMHDR]
  ifNotNil: [:action | self perform: action with: pNMHDR]! !
!RichTextEdit categoriesFor: #enLink:!event handling-win32!private! !
!RichTextEdit categoriesFor: #enSelChange:!event handling-win32!private! !
!RichTextEdit categoriesFor: #eventMask!accessing!private! !
!RichTextEdit categoriesFor: #eventMask:!accessing!private! !
!RichTextEdit categoriesFor: #eventMask:set:!accessing!private! !
!RichTextEdit categoriesFor: #isUrlDetectionEnabled!public!testing! !
!RichTextEdit categoriesFor: #isUrlDetectionEnabled:!accessing!public! !
!RichTextEdit categoriesFor: #nmNotify:!event handling-win32!private! !

RichTextEdit initializeNotificationMap!

"--------------------------------------------
Some test code to demonstrate
----------------------------------------------"

Transcript clear.
(Transcript view subViews first)
 isUrlDetectionEnabled: true;
 when: #linkClicked: perform: [:link | MessageBox notify: 'You clicked: ',
link].
Transcript display: 'http://www.object-arts.com'; cr.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [FR] Evaluate expressions in Transcript

panu@nospam.com
Support at Object Arts wrote:
> <[hidden email]> wrote in message
>  ...
>> Naturally, hyperlink-support would be very groovy, but probably
>> much more effort to implement.
>
> Probably not actually....

Very cool. Thanks for the snippet.

Still, I don't see what harm a menu-option like 'Browse'
or 'Inspect' would do on the Transcript. Transcript
often contains error-messages that refer to classes,
so it would help to be able to go browse them easily
with a menu-option or a keyboard shortcut.

-Panu Viljamaa



>
> ----------------------
> "For DX6"!
>
> NMHDR subclass: #ENLINK
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> classInstanceVariableNames: ''!
>
> !ENLINK methodsFor!
>
> chrg
> ^CHARRANGE fromAddress: (bytes yourAddress + 24)!
>
> lParam
> ^(bytes dwordAtOffset: 20) asExternalAddress!
>
> msg
> ^(bytes dwordAtOffset: 12)!
>
> wParam
> ^(bytes dwordAtOffset: 16)! !
> !ENLINK categoriesFor: #chrg!**compiled accessors**!public! !
> !ENLINK categoriesFor: #lParam!**compiled accessors**!public! !
> !ENLINK categoriesFor: #msg!**compiled accessors**!public! !
> !ENLINK categoriesFor: #wParam!**compiled accessors**!public! !
>
> !ENLINK class methodsFor!
>
> defineFields
> super defineFields.
> self
>  defineField: #msg
>   type: DWORDField readOnly
>   offset: 12;
>  defineField: #wParam
>   type: DWORDField readOnly
>   offset: 16;
>  defineField: #lParam
>   type: LPVOIDField readOnly
>   offset: 20;
>  defineField: #chrg
>   type: (StructureField type: CHARRANGE) beReadOnly
>   offset: 24.
> self byteSize: 32! !
> !ENLINK class categoriesFor: #defineFields!initializing!public! !
>
> RichTextEdit classPool at: 'RtnMap' put: nil!
>
> !RichTextEdit class methodsFor!
>
> initializeNotificationMap
> RtnMap := (IdentityDictionary new)
>    at: EN_LINK put: #enLink:;
>    at: EN_SELCHANGE put: #enSelChange:;
>    shrink;
>    yourself! !
> !RichTextEdit class categoriesFor: #initializeNotificationMap!private! !
>
> !RichTextEdit methodsFor!
>
> enLink: anExternalAddress
> | struct |
> struct := ENLINK fromAddress: anExternalAddress.
> struct msg == WM_LBUTTONUP
>  ifTrue:
>   [| range text |
>   range := struct chrg.
>   text := self plainTextRange: (range cpMin + 1 to: range cpMax).
>   self presenter trigger: #linkClicked: with: text].
> ^nil!
>
> enSelChange: anNMHDR
> self invalidateUserInterface!
>
> eventMask
> ^self sendMessage: EM_GETEVENTMASK!
>
> eventMask: anInteger
> self
>  sendMessage: EM_SETEVENTMASK
>  wParam: 0
>  lParam: anInteger!
>
> eventMask: anInteger set: aBoolean
> self eventMask: (self eventMask mask: anInteger set: aBoolean)!
>
> isUrlDetectionEnabled
> ^(self sendMessage: EM_GETAUTOURLDETECT) asBoolean!
>
> isUrlDetectionEnabled: aBoolean
> self sendMessage: EM_AUTOURLDETECT wParam: aBoolean asParameter.
> self eventMask: ENM_LINK set: aBoolean!
>
> nmNotify: pNMHDR
> ^(RtnMap at: (pNMHDR sdwordAtOffset: 8) ifAbsent: [])
>  ifNil: [super nmNotify: pNMHDR]
>  ifNotNil: [:action | self perform: action with: pNMHDR]! !
> !RichTextEdit categoriesFor: #enLink:!event handling-win32!private! !
> !RichTextEdit categoriesFor: #enSelChange:!event handling-win32!private! !
> !RichTextEdit categoriesFor: #eventMask!accessing!private! !
> !RichTextEdit categoriesFor: #eventMask:!accessing!private! !
> !RichTextEdit categoriesFor: #eventMask:set:!accessing!private! !
> !RichTextEdit categoriesFor: #isUrlDetectionEnabled!public!testing! !
> !RichTextEdit categoriesFor: #isUrlDetectionEnabled:!accessing!public! !
> !RichTextEdit categoriesFor: #nmNotify:!event handling-win32!private! !
>
> RichTextEdit initializeNotificationMap!
>
> "--------------------------------------------
> Some test code to demonstrate
> ----------------------------------------------"
>
> Transcript clear.
> (Transcript view subViews first)
> isUrlDetectionEnabled: true;
> when: #linkClicked: perform: [:link | MessageBox notify: 'You clicked:
> ', link].
> Transcript display: 'http://www.object-arts.com'; cr.


Loading...