add row to refreshingView without repainting entire refreshingView - wicket

We have a refreshingView<shirt> (contained inside a border) set up and outside of the refreshing view we have an ajaxLink that adds a new shirt object to the list that backs the refreshingView. The refreshingView contains textFields and dropdowns for the user to enter information in about the shirts.
Inside the ajaxLink we add a shirt to the list and then add the entire border to the target of the ajaxLink, thus refreshing the border. The problem occurs when you add a row and fill out the information ( shirt color, size, style, etc. ) and add another shirt. Another row for a new shirt is added, but at the same time all the information that was inputted about the first shirt is lost.
Any ideas on how to retain the information of the previously entered shirts?

The previous data is lost, because a refreshingView discards all Items (and the models containing the data) after each rendering.
You can set an ItemReuseStrategy:
refreshingView.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());
Another, more involved way is to only redraw the newly added row. See the answer here: Can I add an element to a RepeatingView without refreshing the latter?

Related

Shape property which references documentsheet property doesn't get updated when documentsheet property changes

I have the following case:
I defined a user property ("User.DocProp") at the documentsheet level. I want to reference this property in a shape property cell ("Prop.SomeProp") and display the shape property as text on the shape.
This is working (I inserted a field into the shape text which points to my shape data). The value of the document property is correctly displayed on the shape.
And when I change the document property the shape's text gets updated. Awesome!
BUT this (update of the shape's text after change of the document property) doesn't work anymore when I have multiple pages each with the same kind of shape as before. When I now change the property on the documentsheet only those shapes get updated which lay on pages that I have navigated to before (since I opened the drawing). On all other pages the shape text will show the old value of the document property. Only when I directly enter the cell in the shapesheet by pressing F2 and leave with ENTER the text will get updated.
I tried several formulas in the shape property with no avail:
=TheDoc!User.DocProp
=SETATREF(TheDoc!User.DocProp)
=SETATREF(TheDoc!User.DocProp,SETATREFEVAL(SETATREFEXPR()))
I can't find a method to force recalculation of formulas neither. What am I missing here?
Screenshot from test drawing

Visio: Creating Automatic Numbered Label

I'm currently working on creating a new stencil for several components I use in Visio and I'm stuck at the point of providing proper labels. If you use a resistor from Visio stencil it automatically generates a label "R1" (for first resistor) and "Rk" for the kth resistor. How can I do something similar for my own stencil ?
1- I need to generate a label "ABCD #" (# number automatically generated based on instance count)
2- How can I position the location of this field?
PS:
1- Visio components have a custom defined field which allows for this (which I don't know how to create)
2- For capacitor for example the shapesheet shows an interesting entry
=SETF(GetRef(User.Label),"""C""&"&ThePage!User.AccumulatorCount)&SETF(GetRef(ThePage!User.AccumulatorCount),ThePage!User.AccumulatorCount+1)
which supposedly is how the count and name are generated (I'm not sure how the AccumulatorCount is defined it differs from element to element).
Thank You!
The EventDrop ShapeSheet cells for various electrical shapes have formulas similar to the one you have discovered:
SETF(GetRef(User.Label),"""C""&"&ThePage!User.AccumulatorCount)&SETF(GetRef(ThePage!User.AccumulatorCount),ThePage!User.AccumulatorCount+1)
The ShapeSheet for the page has a cell: User.AccumulatorCount for capacitors. Other User cells will be added as other shapes are dropped. You can set up your own system by adding a User cell to the page, say: User.Widget. Then you place the "Widget" version of the "SETF" formula into your own shapes.
You can create user cells by:
Open the ShapeSheet for the Page (right-click blank area of page, Show ShapeSheet)
Right-click in ShapeSheet and choose Add Section
Add a User-defined cells section
Find the User-defined cells section and similarly add rows to it via
right-clicking
You change the row names by typing over the red, row-name text on the left.
You enter values and formulas in the cells as you would in Excel.
You can toggle viewing formulas vs. viewing values by pressing F5
while in the ShapeSheet.
You have to make the User cell in the page first, so that your shape can reference it. Once your shape references the page cell, you can drag your shape into a stencil, and it will "drag the page User cell along too". So now, you can drop your Widget shape into a new document, and it will create the page User cell on the fly.
The system is basic and fragile. The count only goes up, and never down. If you have shapes with 1, 2, 3, 4 and you delete 1 and 2, the next shape will still be 5.

Highlight an entire UICollectionView section in Swift

This collection has many items within many sections. I am trying to place a border around each section and further highlight it.
Trail 1:
Using headers and footers I can draw lines (header has top,left,right; footer has left,right,bottom) which look like frame ends. But I can't get them to highlight on item select.
(I don't want to make this too complex by listing my code. I think there are tutorials to create collection headers and footers. But in summary: I created a UICollectionReuseableView class for each, registered them and applied a referenceSize for each of them.)
Trial2:
I can highlight each item, in that section (using a color with alpha overlay), when any item is selected.
(Again in summary: I used a for loop within the didSelectItemAt method.)
If each section was always one row of items, then I could use the item height, but thats not always the case - especially if rotated.
How can I place a border around each section then highlight on item selection?

Access Form layout and design: Header: How do I make my header section look like Google

I would like to rip off Google's design for my Continuous Form. The detail section of the form is set up to display N number of records resulting from a search, and thus cannot be used to create this effect (i think). Everything must go in the header section.
there are 2 primary issues I would like to address in this question:
Two toned background. The header section should have a grey stripe and a white stripe. This stripe needs to extend the full width of the form, which is variable and will depend on the user. (i'm using tabs not pop-ups)
How to right justify certain elements of the header so that they stay close to the right edge, wherever that may fall, just like your account information on Google.
The "Search Results" in the detail section are loaded by setting the form's recordSource to the results of a query defined in VBA, which takes parameters from the search box. The form is continuous.
Any ideas how to hack this into place?
Recent versions of MS Access provide improved form layout features when using the ACCDB database file format.
The screen captures below are based on a form in Access 2010. The second image is after the form width was expanded, but it's scaled down for display on this web page. However you can open those images directly to compare their relative widths.
The grey color is from the form header's Back Color property. The white box is a simple text box whose Back Color is white and Back Style is Normal (not Transparent).
The text box's Horizontal Anchor property is Both, and its Can Grow property is Yes. The other 3 items ("?", "Button 2", and "Button 3") are command buttons. Their Horizontal Anchors are set to Right and their Can Grow properties are No.
The result of those properties is that when the form expands, those command buttons maintain their size are are kept right-aligned within the form. And the text box stretches to fill the remaining available space.
Note this behavior is accomplished without any VBA code.
I think these layout capabilities were introduced in Access 2007 and perhaps refined in 2010.
For the background, use two rectangles with transparent borders, one back color gray, one white. You can size them to the form by using the form's InsideWidth property. For example:
Private Sub Form_Resize()
rect1.Width = Me.InsideWidth
rect2.Width = Me.InsideWidth
End Sub
I would do a similar thing for the buttons/images/etc you want right justified. Set their Left property relative to the form's width:
mySettingsButton.Left = Me.InsideWidth - 300
Keep in mind all the measurements are twips (1440 twips/inch)

Objective C - Create Multiple TextFields for the User, then randomly select one and output the Entered Data

Basically what I am trying to do is:
1) The user sets the number of choices he wants e.g. 3 choices which are "A", "B", "C"
[Done this]
2) The next view is loaded and the right amount of boxes are created, 3 in this case. The boxes need to be blank at first and then the user enters their choices into the boxes.
e.g. "A", "B", "C"
Note: I tried create multiple text boxes automatically, but I found that after about 6 boxes the screen wouldn't scroll and therefore looked very tacky
3)At a click of a button, one of the textboxes is selected randomly. The inputed data from this randomly selected box is then displayed in NSLog or Label or file, which i will then use in another view.
Thanks
Dan
Hey, you could make a scrollView out of the 2th view. That way, you can still automatically create textfields, and the screen will scroll. Check out this link for more information on how to create a scrollview. Perhaps you can make the scrollview's size dynamically (depending on how much textfields you have).
About selecting a random textfield, use arc4random() More about that can be found here.