Hi,
I try to add an addChild method to my TreeView Agent. The problem I have that some things work but others don't. All depends where you add a child to a root element at the end of the list as a subchild ??? For the moment I have sort of the following code. addChild | newNode myParent orgIndex newIndex myTree | orgIndex := self selectionIndex. newNode := (HierarchyTreeNode new) name: 'New Item'; proj_id: self selection proj_id. parent getGlorpSession inUnitOfWorkDo: [parent getGlorpSession register: newNode]. parent getGlorpSession inUnitOfWorkDo: [myParent := parent getGlorpSession readOneOf: HierarchyTreeNode where: [:each | each id = self selection id]. "Registring self selection gives a duplicate primary key error so I reread" newNode parent: myParent. myParent children add: newNode]. "Up to here all is fine and my Database is now correctly updated with a new node and valid parent child relationships" pane tree at: orgIndex put: (TreeNode on: myParent). "this seems to have no effect allthough inspecting pane tree shows that all looks fine" self selection: myParent. 'No effect or some sometimes" self selection children add: newNode. "this does have effect when I don't add the line above" pane tree refresh: self selection. "has effect but depends where you are at root at the end of the list as a child" pane tree refreshRoot. 'this has effect but only when go step by step through a debugger" 1 to: pane tree size do: [:n | myTree := pane tree at: n. myTree object id = myParent id ifTrue: [newIndex := n]]. "This obviously works but looks stupid" self selectionIndex: newIndex. pane tree expandAt: newIndex. self selection: newNode "this works" self editSelection "this works to ". _________________________________________ Notice that there is a small bug while editing the selection as the visible place to edit doesn't grow when you type. Rgrds, @+Maarten, |
Maarten,
>The problem I have that some things work but others don't. All depends >where you add a child to a root element at the end of the list as a >subchild ??? I will look into this. And So It Goes Sames ______________________________________________________________________ Samuel S. Shuster [|] VisualWorks Engineering, GUI Project Smalltalk Enables Success -- What Are YOU Using? |
In reply to this post by Maarten Mostert-2
Maarten:
>I try to add an addChild method to my TreeView Agent. > >The problem I have that some things work but others don't. All depends >where you add a child to a root element at the end of the list as a >subchild ??? > >For the moment I have sort of the following code. [...] Yeah. I'm afraid I'm not sure what is going on here. I hate to say this, but maybe if you have an example I can work with? Sorry, but Trees are almost as tough for me as Scrollbars. I really need a generic example, or more info. I'll try to figure it out, but .... >Notice that there is a small bug while editing the selection as the >visible place to edit doesn't grow when you type. Actually, it is not supposed to change size. What you see is what it is. Maybe in the future we can add a feature to grow it, but.. And So It Goes Sames ______________________________________________________________________ Samuel S. Shuster [|] VisualWorks Engineering, GUI Project Smalltalk Enables Success -- What Are YOU Using? |
Samuel S.Shuster a écrit :
I'll make you an example but that'll take some time.Maarten:I try to add an addChild method to my TreeView Agent. The problem I have that some things work but others don't. All depends where you add a child to a root element at the end of the list as a subchild ??? For the moment I have sort of the following code.[...] Yeah. I'm afraid I'm not sure what is going on here. I hate to say this, but maybe if you have an example I can work with? Sorry, but Trees are almost as tough for me as Scrollbars. I really need a generic example, or more info. I'll try to figure it out, but .... Well offcourse you can just make the string a bit longer to give some space to re type and for the time being that is okéNotice that there is a small bug while editing the selection as the visible place to edit doesn't grow when you type.Actually, it is not supposed to change size. What you see is what it is. Maybe in the future we can add a feature to grow it, but.. And So It Goes Sames ______________________________________________________________________ Samuel S. Shuster [|] VisualWorks Engineering, GUI Project Smalltalk Enables Success -- What Are YOU Using? |
In reply to this post by Samuel S. Shuster <sames@interaccess.com>
So here you go with the example, you'll have both the slider and treeview problem. Remember for the slider problem I used the widget as an instance variable to use it twice on different subcanvasses. Only the latest constructed behaves correctly. For the tree View problem try to add things to the project tree. The method to look at is addChild in the subclassed agent. The main problem is with using: <<pane tree refreshRoot>> and or <<pane tree refresh: self selection>>. For me the latter should do the job on his own and correctly refresh the three no matter the selection. I hope you see what I mean. (It's a bit messy as all is extracted elsewhere) Regards, @+Maarten, Samuel S.Shuster a écrit : Maarten:I try to add an addChild method to my TreeView Agent. The problem I have that some things work but others don't. All depends where you add a child to a root element at the end of the list as a subchild ??? For the moment I have sort of the following code.[...] Yeah. I'm afraid I'm not sure what is going on here. I hate to say this, but maybe if you have an example I can work with? Sorry, but Trees are almost as tough for me as Scrollbars. I really need a generic example, or more info. I'll try to figure it out, but ....Notice that there is a small bug while editing the selection as the visible place to edit doesn't grow when you type.Actually, it is not supposed to change size. What you see is what it is. Maybe in the future we can add a feature to grow it, but.. And So It Goes Sames ______________________________________________________________________ Samuel S. Shuster [|] VisualWorks Engineering, GUI Project Smalltalk Enables Success -- What Are YOU Using? <?xml version="1.0"?> <st-source> <time-stamp>From VisualWorks® NonCommercial, 7.5 of 16 April 2007 on 15 Augustus 2007 at 06:50:41</time-stamp> <!-- Package ApricotTest* --> <class> <name>TreeViewAgentStakePoint</name> <environment>Maarten</environment> <super>Widgetry.TreeViewAgent</super> <private>false</private> <indexed-type>none</indexed-type> <inst-vars>addChildAction parent </inst-vars> <class-inst-vars></class-inst-vars> <imports> private Widgetry.* </imports> <category>Widgetry-Agents</category> <attributes> <package>ApricotTest</package> </attributes> </class> <class> <name>StakePointTest</name> <environment>Smalltalk</environment> <super>Widgetry.UserInterface</super> <private>false</private> <indexed-type>none</indexed-type> <inst-vars>principalTabControl hierarchyTreeView organisationTreeView resourceList taskGrid gridValue eventGrid mainSelectorResize hierarchyTreeModel artificialIndex </inst-vars> <class-inst-vars></class-inst-vars> <imports> private Widgetry.* </imports> <category>Apricot</category> <attributes> <package>ApricotTest</package> </attributes> </class> <class> <name>TreeViewStakePoint</name> <environment>Maarten</environment> <super>Widgetry.TreeView</super> <private>false</private> <indexed-type>none</indexed-type> <inst-vars></inst-vars> <class-inst-vars></class-inst-vars> <imports> private Widgetry.* </imports> <category>Widgetry-Panes</category> <attributes> <package>ApricotTest</package> </attributes> </class> <class> <name>HierarchyTreeNode</name> <environment>Smalltalk</environment> <super>Core.Object</super> <private>false</private> <indexed-type>none</indexed-type> <inst-vars>id name parent children components stakecol proj_id </inst-vars> <class-inst-vars></class-inst-vars> <imports></imports> <category>BambooMain</category> <attributes> <package>ApricotTest</package> </attributes> </class> <methods> <class-id>HierarchyTreeNode class</class-id> <category>instance creation</category> <body package="ApricotTest" selector="new">new "Answer a newly created and initialized instance." ^super new initialize</body> </methods> <methods> <class-id>HierarchyTreeNode</class-id> <category>accessing-collection</category> <body package="ApricotTest" selector="addStake:">addStake: aStake stakecol add: aStake</body> <body package="ApricotTest" selector="addChild:">addChild: someChild "Add aChild as a child of the receiver, and set someChild's parent to be the receiver." super halt. super addChild: someChild. someChild parent: self</body> </methods> <methods> <class-id>HierarchyTreeNode</class-id> <category>converting</category> <body package="ApricotTest" selector="asHierarchyTreeNode">asHierarchyTreeNode | newHierarchyTreeNode | newHierarchyTreeNode := (HierarchyTreeNode new) id: self key; name: self value. self children do: [:each | newHierarchyTreeNode add: each asHierarchyTreeNode]. ^newHierarchyTreeNode</body> <body package="ApricotTest" selector="asHierarchyNode">asHierarchyNode | newHierarchyNode | newHierarchyNode := HierarchyNode key: self id value: self name. self children do: [:each | newHierarchyNode addChild: each asHierarchyNode]. ^newHierarchyNode</body> </methods> <methods> <class-id>HierarchyTreeNode</class-id> <category>accessing</category> <body package="ApricotTest" selector="components">components ^components</body> <body package="ApricotTest" selector="proj_id:">proj_id: anObject proj_id := anObject</body> <body package="ApricotTest" selector="key">key ^id</body> <body package="ApricotTest" selector="children">children ^children</body> <body package="ApricotTest" selector="children:">children: anObject super halt. children := anObject</body> <body package="ApricotTest" selector="proj_id">proj_id ^proj_id</body> <body package="ApricotTest" selector="name">name ^name</body> <body package="ApricotTest" selector="parent:">parent: anObject parent := anObject</body> <body package="ApricotTest" selector="childs">childs self children size > 0 ifTrue: [Transcript show: self id printString, self name; cr. self children do: [:each | each childs]] ifFalse: [Transcript show: self id printString , self name; cr]</body> <body package="ApricotTest" selector="patriarchProject">patriarchProject "Return the topmost parent in the parent/child hierarchy containing the receiver." ^self parent parent isNil ifTrue: [self] ifFalse: [self parent patriarchProject]</body> <body package="ApricotTest" selector="stakecol:">stakecol: anObject stakecol := anObject</body> <body package="ApricotTest" selector="stakecol">stakecol ^stakecol</body> <body package="ApricotTest" selector="id">id ^id</body> <body package="ApricotTest" selector="components:">components: anObject components := anObject</body> <body package="ApricotTest" selector="key:">key: anKey id := anKey</body> <body package="ApricotTest" selector="parent">parent ^parent</body> <body package="ApricotTest" selector="id:">id: anObject id := anObject</body> <body package="ApricotTest" selector="name:">name: anObject name := anObject</body> </methods> <methods> <class-id>HierarchyTreeNode</class-id> <category>initialize-release</category> <body package="ApricotTest" selector="initialize">initialize children := OrderedCollection new. stakecol := OrderedCollection new. components := OrderedCollection new</body> </methods> <methods> <class-id>HierarchyTreeNode</class-id> <category>printing</category> <body package="ApricotTest" selector="printOn:">printOn: aStream aStream nextPutAll: name "Used to be like this ! Modified for Widgetry aStream nextPutAll: 'Node('. id printOn: aStream. aStream nextPut: $)."</body> </methods> <methods> <class-id>Maarten.TreeViewStakePoint class</class-id> <category>actions</category> <body package="ApricotTest" selector="createActionsFor:">createActionsFor: instance | actions | actions := super createActionsFor: instance. actions add: (Action id: #clearLookup action: [instance agent clearTippyType. instance keyboardProcessor doCancelAction]). actions add: (Action id: #backspaceLookup action: [instance agent clipLookupString]). actions add: (Action id: #enterReturnAction action: [instance agent executeCrEnterAction]). actions add: (Action id: #expandSelection action: [instance agent expandSelection]). actions add: (Action id: #expandSelectionFully action: [instance agent expandSelectionFully]). actions add: (Action id: #contractSelection action: [instance agent contractSelection]). actions add: (Action id: #editSelection action: [instance agent editSelection]). actions add: (Action id: #addChild action: [instance agent addChild]). "actions add: (Action id: #addChildAction action: [instance agent addChildAction])." ^actions</body> </methods> <methods> <class-id>Maarten.TreeViewStakePoint</class-id> <category>constants - classes</category> <body package="ApricotTest" selector="agentClass">agentClass ^TreeViewAgentStakePoint</body> </methods> <methods> <class-id>Maarten.TreeViewStakePoint</class-id> <category>accessing</category> <body package="ApricotTest" selector="addChild">addChild ^self agent addChild</body> </methods> <methods> <class-id>Maarten.TreeViewAgentStakePoint</class-id> <category>menu</category> <body package="ApricotTest" selector="defaultPopupMenu">defaultPopupMenu | popup menuPart | popup := Menu new id: #defaultTreeMenu. menuPart := Menu new id: #expandGroup. menuPart addMenuItem: (MenuItem new label: #expandSelection << #menus >> 'Expand Selection'; actionID: #expandSelection; id: #expandSelection; enablementSelector: #hasSelection). menuPart addMenuItem: (MenuItem new label: #expandSelectionFully << #menus >> 'Expand Selection Fully'; actionID: #expandSelectionFully; id: #expandSelectionFully; enablementSelector: #hasSelection). popup addMenu: menuPart. popup addMenuItem: (MenuItem new label: #contractSelection << #menus >> 'Contract Selection'; actionID: #contractSelection; id: #contractSelection; enablementSelector: #hasSelection). popup addMenuItem: (MenuItem new label: #editSelection << #menus >> 'Edit Selection'; actionID: #editSelection; id: #editSelection; hiddenSelector: #disallowEditing; enablementSelector: #hasSelection). popup addMenuItem: (MenuItem new label: #editSelection << #menus >> 'Edit Selection'; actionID: #editSelection; id: #editSelection; hiddenSelector: #disallowEditing; enablementSelector: #hasSelection). ^popup</body> </methods> <methods> <class-id>Maarten.TreeViewAgentStakePoint</class-id> <category>collaboration</category> <body package="ApricotTest" selector="addChild">addChild | newNode | newNode := (HierarchyTreeNode new) name: 'New Item'; proj_id: self selection proj_id. newNode id: parent newArtificialIndex. self selection children add: newNode. self selection parent isNil ifTrue: [pane tree refreshRoot] ifFalse: [pane tree refresh: self selection]. self selection: newNode. self editSelection "super halt."</body> </methods> <methods> <class-id>Maarten.TreeViewAgentStakePoint</class-id> <category>initialize-release</category> <body package="ApricotTest" selector="initialize">initialize super initialize. ^self</body> </methods> <methods> <class-id>Maarten.TreeViewAgentStakePoint</class-id> <category>accessing</category> <body package="ApricotTest" selector="parent:">parent: anObject parent := anObject</body> <body package="ApricotTest" selector="parent">parent ^parent</body> </methods> <methods> <class-id>StakePointTest</class-id> <category>interface</category> <body package="ApricotTest" selector="resizerBetweenGridGanttEvent">resizerBetweenGridGanttEvent | resizer | resizer := ResizingSplitter new. resizer beVertical. resizer raisedBorder: true. resizer frame: (FractionalFrame fractionLeft: 0.35 right: 0.35 top: 0 bottom: 1). (resizer frame) leftOffset: -2; rightOffset: 2. resizer aboveLeftWidgets: #(#taskGridID). resizer belowRightWidgets: #(#ganttPaneID #eventGridID). resizer id: #BetweenGridAndGantt. ^resizer</body> <body package="ApricotTest" selector="createGridGanttEventTabControl:">createGridGanttEventTabControl: form | gantEventTabControl | gantEventTabControl := Widgetry.TabControl new. gantEventTabControl id: #gantEventTabControlID. gantEventTabControl frame: ((Widgetry.FractionalFrame fractionLeft: 0.2 right: 1 top: 0 bottom: 1) topOffset: 1; leftOffset: 2; bottomOffset: 2; rightOffset: 2). gantEventTabControl addPage: self createGanttForm label: 'Gantt' "image: TaskManagerResources mileStoneIcon". gantEventTabControl addPage: self createEventForm label: 'Events' "image: TaskManagerResources resource16x16Icon". gantEventTabControl showPage: 1. gantEventTabControl noDecoration: false. form addComponent: gantEventTabControl</body> <body package="ApricotTest" selector="createEventForm">createEventForm | form | form := Widgetry.Form new. form addComponent: taskGrid. eventGrid := Widgetry.Grid new. eventGrid rowHeaderAsButtons: true. eventGrid verticalScrollbar: true. eventGrid id: #eventGridID. eventGrid frame: ((Widgetry.FractionalFrame fractionLeft: 0.35 right: 1 top: 0 bottom: 1) topOffset: 0). form addComponent: eventGrid. form addComponent: mainSelectorResize. form addComponent: self resizerBetweenGridGanttEvent. ^form</body> <body package="ApricotTest" selector="createMainSelectorForm:">createMainSelectorForm: form | projectLabel | projectLabel := Widgetry.DisplayLabel string: 'Projects'. projectLabel frame: (Widgetry.FractionalFrame offsetLeft: 0 right: 100 top: 4 bottom: 20). "to correct" form addComponent: projectLabel. hierarchyTreeView frame: ((Widgetry.FractionalFrame fractionLeft: 0 right: 0.2 top: 0 bottom: 1) rightOffset: -2; topOffset: 20). hierarchyTreeView id: #hierarchyTreeViewID. hierarchyTreeView showRootImage: false. hierarchyTreeView verticalScrollbar: true. hierarchyTreeView beMultiSelect. hierarchyTreeView quietlyUseFolderIcons: true. hierarchyTreeView allowEditing: true. hierarchyTreeView menu: self projectsPopupMenu. hierarchyTreeView agent parent: self. hierarchyTreeView editSaveAction: [:arg1 :arg2 | self renameHierarchyNode: arg1 and: arg2]. hierarchyTreeView tree: hierarchyTreeModel. form addComponent: hierarchyTreeView " form addComponent: (self createOrganisationForm: principalSlectorID)"</body> <body package="ApricotTest" selector="createMainSuiviForm">createMainSuiviForm | suiviForm resizer | suiviForm := Widgetry.Form new. self createMainSelectorForm: suiviForm. self createSuiviAvancementTabControl: suiviForm. resizer := ResizingSplitter new. resizer beVertical. resizer raisedBorder: true. resizer frame: ((FractionalFrame fractionLeft: 0.2 right: 0.2 top: 0 bottom: 1) leftOffset: -2; rightOffset: 2; topOffset: 20). resizer aboveLeftWidgets: #(#hierarchyTreeViewID). resizer belowRightWidgets: #(#OrganisationFormID #avancementDataTabControlID). "resizer id: #suiviResizerID." suiviForm addComponent: resizer. " self createMainResizer: suiviForm." ^suiviForm</body> <body package="ApricotTest" selector="createInterface">createInterface principalTabControl frame: (Widgetry.FractionalFrame fractionLeft: 0 right: 1 top: 0 bottom: 1). principalTabControl frame bottomOffset: -20. principalTabControl id: #principalTabControlID. principalTabControl addPage: self createMainDeskTopForm label: 'Desktop ' " image: TaskManagerResources mileStoneIcon". principalTabControl addPage: self createMainSuiviForm label: 'Progress ' " image: TaskManagerResources resource16x16Icon". principalTabControl showPage: 1. self addComponent: principalTabControl. "self addComponent: self createBottomForm"</body> <body package="ApricotTest" selector="createGanttForm">createGanttForm | form | form := Widgetry.Form new. taskGrid frame: ((Widgetry.FractionalFrame fractionLeft: 0 right: 0.35 top: 0 bottom: 1) leftOffset: 0; rightOffset: -2; topOffset: 0). form addComponent: taskGrid. " ganttPane := Maarten.GanttPane new. ganttPane frame: ((Widgetry.FractionalFrame fractionLeft: 0.35 right: 1 top: 0 bottom: 1) leftOffset: 2; topOffset: 0)." " ganttPane frame rightRelation: #BetweenGridAndGantt." " ganttPane foreground: Color white. ganttPane verticalScrollbar: true. ganttPane id: #ganttPaneID. form addComponent: ganttPane." form addComponent: self resizerBetweenGridGanttEvent. ^form</body> <body package="ApricotTest" selector="createSuiviAvancementTabControl:">createSuiviAvancementTabControl: form | avancementDataTabControl | avancementDataTabControl := Widgetry.TabControl new. avancementDataTabControl id: #avancementDataTabControlID. avancementDataTabControl frame: ((Widgetry.FractionalFrame fractionLeft: 0.2 right: 1 top: 0.2 bottom: 1) topOffset: 0; leftOffset: 2; bottomOffset: 2; rightOffset: 2). avancementDataTabControl addPage: self createEventForm label: 'Avancement' " image: TaskManagerResources mileStoneIcon". avancementDataTabControl addPage: self createEventForm label: 'Data' " image: TaskManagerResources resource16x16Icon". avancementDataTabControl addPage: self createEventForm label: 'Resource' " image: TaskManagerResources resource16x16Icon". avancementDataTabControl showPage: 1. avancementDataTabControl noDecoration: false. form addComponent: avancementDataTabControl</body> <body package="ApricotTest" selector="createMainDeskTopForm">createMainDeskTopForm | deskTopForm resizer | deskTopForm := Widgetry.Form new. self createMainSelectorForm: deskTopForm. self createGridGanttEventTabControl: deskTopForm. resizer := ResizingSplitter new. resizer beVertical. resizer raisedBorder: true. resizer frame: ((FractionalFrame fractionLeft: 0.2 right: 0.2 top: 0 bottom: 1) leftOffset: -2; rightOffset: 2; topOffset: 20). resizer aboveLeftWidgets: #(#hierarchyTreeViewID). resizer belowRightWidgets: #(#OrganisationFormID #gantEventTabControlID #organisationFormResizerID). "resizer id: #mainDeskTopID." deskTopForm addComponent: resizer. ^deskTopForm</body> <body package="ApricotTest" selector="createGridWithoutFrame">createGridWithoutFrame taskGrid := Widgetry.Grid new. taskGrid verticalScrollbar: true. taskGrid horizontalScrollbar: true. taskGrid id: #taskGridID. taskGrid columnHeaderAsButtons: true. taskGrid allowColumnResizing: true. taskGrid allowRowResizing: false. taskGrid addColumn: ((Widgetry.TextEditColumn new) id: #designationUpdater:; editable: true; accessor: [:modelValue | gridValue := modelValue task_name. gridValue]; mutator: [:modelObject :newValue | gridValue := newValue]; width: 150; labelString: 'Designation'). taskGrid addColumn: ((Widgetry.Column new) id: #startDateUpdater:; editable: true; accessor: [:modelValue | gridValue := Locale current printAsTime: modelValue task_start_date policyNamed: #short. gridValue]; mutator: [:modelObject :newValue | gridValue := newValue]; width: 90; labelString: 'Task Start'). taskGrid addColumn: ((Widgetry.Column new) id: #finishDateUpdater:; editable: true; accessor: [:modelValue | gridValue := Locale current printAsTime: modelValue task_finish_date policyNamed: #short. gridValue]; mutator: [:modelObject :newValue | gridValue := newValue. Transcript show: modelObject value task_name , ' Value modified ' , modelObject value task_finish_date printString]; width: 90; labelString: 'Task End')</body> <body package="ApricotTest" selector="projectsPopupMenu">projectsPopupMenu | popup menuPart menuAddRemove | popup := Menu new id: #defaultTreeMenu. menuPart := Menu new id: #expandGroup. menuAddRemove := Menu new id: #addRemoveGroup. menuPart addMenuItem: ((MenuItem new) label: #expandSelection << #menus >> 'Expand Selection'; actionID: #expandSelection; id: #expandSelection; enablementSelector: #hasSelection). menuPart addMenuItem: ((MenuItem new) label: #expandSelectionFully << #menus >> 'Expand Selection Fully'; actionID: #expandSelectionFully; id: #expandSelectionFully; enablementSelector: #hasSelection). popup addMenu: menuPart. popup addMenuItem: ((MenuItem new) label: #contractSelection << #menus >> 'Contract Selection'; actionID: #contractSelection; id: #contractSelection; enablementSelector: #hasSelection). popup addMenuItem: ((MenuItem new) label: #editSelection << #menus >> 'Edit Selection'; actionID: #editSelection; id: #editSelection; hiddenSelector: #disallowEditing; enablementSelector: #hasSelection). menuAddRemove addMenuItem: ((MenuItem new) label: #editSelection << #menus >> 'Add Child'; actionID: #addChild; id: #addChild; hiddenSelector: #disallowEditing; enablementSelector: #hasSelection). popup addMenu: menuAddRemove. ^popup</body> <body package="ApricotTest" selector="hookupWindow">hookupWindow self specID: #mainWindow. self mainWindow label: 'Test and Show some problems'. (self mainWindow frame) specifiedSize: 650 @ 550; minimumSize: 400 @ 300</body> </methods> <methods> <class-id>StakePointTest</class-id> <category>initialize-release</category> <body package="ApricotTest" selector="setHierarchyTreeModel">setHierarchyTreeModel | root | root := (HierarchyTreeNode new) id: #root; name: 'root'. root children add: ((HierarchyTreeNode new name: 'first') id: 1). root children add: ((HierarchyTreeNode new name: 'second') id: 2). hierarchyTreeModel := (Widgetry.Tree on: root childrenBlock: [:value | value children]) displayRoot: false</body> <body package="ApricotTest" selector="initialize">initialize "StakePointTest open" super initialize. artificialIndex:=2. " domainModel := UI.ValueModel new. currentValue := self domainModel value printString asObservedValue." TaskListEntry initialize. "just to make sure we have the icons if requested so" ResourceListEntry initialize. "To make sure we have the icons" principalTabControl := Widgetry.TabControl new. hierarchyTreeView :=Maarten.TreeViewStakePoint new. organisationTreeView := Maarten.TreeViewStakePoint new. organisationTreeView verticalScrollbar: true. organisationTreeView beMultiSelect. resourceList := Widgetry.ListBox new. self createGridWithoutFrame. self setHierarchyTreeModel</body> </methods> <methods> <class-id>StakePointTest</class-id> <category>accessing</category> <body package="ApricotTest" selector="artificialIndex">artificialIndex ^artificialIndex</body> <body package="ApricotTest" selector="renameHierarchyNode:and:">renameHierarchyNode: newName and: editedNode editedNode name: newName</body> <body package="ApricotTest" selector="newArtificialIndex">newArtificialIndex artificialIndex := artificialIndex + 1. ^artificialIndex</body> <body package="ApricotTest" selector="artificialIndex:">artificialIndex: anObject artificialIndex := anObject</body> </methods> </st-source> |
Maarten,
>I hope you see what I mean. (It's a bit messy as all is extracted elsewhere) You have run into an old Tree problem which we have on our list of things to fix, but not for a while yet. The issue is that when you do a refresh of a tree that has open items, the previously open items don't remain open. However, for your case, the fix is to force a expandRootFully before doing the selection (as seen below). addChild | newNode | newNode := (HierarchyTreeNode new) name: 'New Item'; proj_id: self selection proj_id. newNode id: parent newArtificialIndex. self selection children add: newNode. self selection parent isNil ifTrue: [pane tree refreshRoot] ifFalse: [pane tree refresh: self selection]. pane tree expandRootFully. self selection: newNode. self editSelection "super halt." I hope that helps in the mean time. And So It Goes Sames ______________________________________________________________________ Samuel S. Shuster [|] VisualWorks Engineering, GUI Project Smalltalk Enables Success -- What Are YOU Using? |
Free forum by Nabble | Edit this page |