Search Results

Search found 57 results on 3 pages for 'autoscroll'.

Page 1/3 | 1 2 3  | Next Page >

  • Autoscroll on parent panel, when there is overflow on child panels.Extjs

    - by Ashwin
    I'm having a single Parent Panel, which has 2 child panels. One has content dynamically created, while the other is fixed height and width. The Parent panel is using border layout, with center and east regions defined. I'm trying to get autoscroll to trigger on the parent panel when there is an overflow on on the center region panel. I've set the autoscroll option to true to the parent panel, but everytime there is an overflow on the center panel, it just gets cuts off. When I'm adding an overflow to center region panel, i get a scrollbar for that panel alone. I don't need that, but rather I want it on the entire Parent Panel. Let me know if anyone has any suggestions..

    Read the article

  • VB.net Listbox Autoscroll

    - by xzerox
    Well I am trying to autoscroll my ListBox or display everything the opposite way just like a shoutbox. Please post the code here on how to do it. I have tried many ways but they either gave me errors or didn't work.

    Read the article

  • AutoScroll panel working intermittently.

    - by Edward Boyle
    I spent hours last week trying to get AutoScroll to function properly on a derived/inherited panel control I have been writing. I found no answers on my own so I posted to several forums and move onto other code while I wait for a reply. Then out of nowhere, it started working properly. Now, Today (about a week later) I notice it is no longer working again!  I go back to those old posts with hopes I will find an answer – No such luck. I Google for about two hours reading everything I come across. I was just about to write a new custom control from the ground up, perhaps use a little unmanaged code to force things to function properly. All I knew was “options in front of me = dealys”.  Just before I gave up, my head in my hands,  Jordan Sirwin’s appropriately titled blog post: “C#: Windows Panel AutoScroll Bug / Intended Suckyness” saves the day! In order for scroll bars to display, there must be at least one control in the Panel with AutoSize set to true. This is absurd… I’m not sure if this is a bug or intended, but it’s stupid. –I feel your pain. How many others have spent hours on this, or worse,  just plain given up? I want those hours back Damnit!

    Read the article

  • ExtJS: Autoscroll vertical FormPanels added to panel

    - by Sarge
    Hi All, I'm writing an app where I have a BorderLayout for the entire page. In the south part I have a Panel to which I add FormPanels. I would like to be able to scroll that Panel so I can scroll through the FormPanels. So far, nothing I've found from searches has helped. I don't quite understand what ExtJS requires in terms of the combination of LayoutManagers, setting the size and setting AutoScroll. Any partial tips will be gratefully followed up. A code snippet: createTrailJunctionPanel = function(trailJunction) { var trailJunctionPanel = new Ext.form.FormPanel({ labelWidth: 75, width: 350, defaultType: 'textfield', items: [{ fieldLabel: 'Junction Name', name: 'junction-name' }], autoScroll:true, //anchor: '100% 100%', height: 100 }); matchedTrailJunctionsPanel.add(trailJunctionPanel); if(trailJunction.publicTrailSegments.length == 0) { matchedTrailJunctionsPanel.add(new Ext.form.Label({text: 'No public trails matched'})); } else { var grid = new Ext.grid.GridPanel({ store: mapMatchObjectStore, columns: [ {id:'publicTrailSegment',header: 'Trail', width: 160, sortable: true, dataIndex: 'publicTrailSegment'} ], stripeRows: true, autoExpandColumn: 'publicTrailSegment', height: 350, width: 600, title: 'Matched Trail Junctions' }); matchedTrailJunctionsPanel.add(grid); } matchedTrailJunctionsPanel.doLayout(); } matchedTrailJunctionsPanel = new Ext.Panel({ title: "Matched Trail Junctions2", id: "matched-trail-junctions", autoScroll:true //layout: 'anchor' });

    Read the article

  • autoscroll problem

    - by deepasundarip
    I have a panel and in that a control should get added on the panel click of the button in that control.. I docked those controls to bottom since i have another control which has to be at top always... Now the problem is, I set a maxsize so that after the maxsize is reached the autoscroll of the panel should kick in, and the requirement is like when a control is added, scroll should slide down to the latest added control.. I don't know how to achieve that requirement... Edit this code on the controls button click... SearchCriterionControl control = new SearchCriterionControl(); control.SupportedMetaDataItems = this.supportedSearchParams; control.AddOrRemoveButtonClick += new EventHandler(AddOrRemoveSearchItemsButtonClick); control.Location = new Point(SearchCriteriaControl.STARTWIDTH, this.searchCritenControl.Height * (this.pnlSearchItems.Controls.Count - 1) + (this.expanderWithLabelSearch.Height) + SearchCriteriaControl.MARGIN * 2); this.SuspendLayout(); this.pnlSearchItems.Controls.Add(control); this.ResumeLayout(false); this.PerformLayout(); control.Focus(); And this to place the controls accordingly on panel: this.pnlSearchItems.AutoScroll = false; this.pnlSearchItems.Height = this.expanderWithLabelSearch.Height + (numberOfControls) * this.searchCritenControl.Height + SearchCriteriaControl.MARGIN * 2; this.tlpSearchBy.Height = this.pnlSearchItems.Height; this.Height = this.pnlSearchItems.Height + his.pnlGroupItems.Height + this.pnlControls.Height + SearchCriteriaControl.MARGIN * 4; this.tblGroupBy.Location = new Point(SearchCriteriaControl.STARTWIDTH, this.pnlSearchItems.Height + SearchCriteriaControl.MARGIN * 2);

    Read the article

  • AutoScroll issues with custom layout on Windows Forms application

    - by Lurker Indeed
    I've implemented a basic custom layout engine in Windows Forms that does control sizing and positioning. I was hoping to allow the AutoScroll features to work untouched, but any time I have enough controls on the screen to require a scroll bar, some of the layout events that get fired (i.e, a rich text box that expands the height as it types) not only fire the layout events, but they force the scroll bar back at (0,0). Do I have any options besides looking at the scroll position and positioning the controls manually based on that?

    Read the article

  • How To AutoScroll a DataGridView during Drag and Drop

    - by Mason
    One of the forms in my C# .NET application has multiple DataGridViews that implement drag and drop to move the rows around. The drag and drop mostly works right, but I've been having a hard time getting the DataGridViews to AutoScroll - when a row is dragged near the top or bottom of the box, to scroll it in that direction. So far, I've tried implementing a version of this solution. I have a ScrollingGridView class inheriting from DataGridView that implements the described timer, and according to the debugger, the timer is firing appropriately, but the timer code: SendMessage(Handle, WM_VSCROLL, (IntPtr)scrollDirectionInt, IntPtr.Zero); doesn't do anything as far as I can tell, possibly because I have multiple DataGridViews in the form. I also tried modifying the AutoScrollOffset property, but that didn't do anything either. Investigation of the DataGridView and ScrollBar classes doesn't seem to suggest any other commands or functions that will actually make the DataGridView scroll. Can anyone help me with a function that will actually scroll the DataGridView, or some other way to solve the problem?

    Read the article

  • How to autoscroll on WPF datagrid

    - by Christian
    Hi, I think I am stupid. I searched now for 15 minutes, and found several different solutions for scrolling on datagrids, but none seems to work for me. I am using WPF with .NET 3.5 and the WPF Toolkit DataGrid. My grid gets updated when my observable collection changes, works perfectly. Now, my DataGrid is located inside a normal Grid and scrollbars appear if the DataGrid gets to big. Also fine... And know, the 1.000.000 $ question: How do I get the datagrid to scroll to the last row. There is: no AutoScroll Property no CurrentRowSelected Index a CurrentCell, but no Collection I could use for CurrentCell = AllCells.Last Any ideas? I feel really stupid, and it seems strange that this question is so hard. What am I missing?

    Read the article

  • UITextView autoscroll to last line

    - by MihaiD
    Hi *, When writing in a UITextView more text than can fit entirely inside it, the text will scroll up and the cursor will often place itself one or two lines above the view's bottom line. This is a bit frustrating as I want my application to make good use of the entire height of the text view. Basically what I want is to configure the UITextView to write up to it's lowest part and not use it just for scrolling. I've seen some similar questions here, here and here. However I've not seen a proper solution yet. Thanks

    Read the article

  • Android: Autoscrolling HorizontalScrollView

    - by DroidIn.net
    I'm using the following code to simulate tabs and since there are more tabs that width can accommodate user can scroll left or right to make a tab button visible. It all works, however I also provide user with ability to fling between tabs by swiping finger left or right on the tab contents. Again - it works. But when I fling to the rightmost tab its corresponding button is barely visible. I want to autoscroll table inside the HorizontalScrollView so the selected tab button will be visible but when I execute HorizontalScrollView.smoothScrollTo(300, 0) nothing happens. It doen't matter how high I set first x parameter nothing will ever move (yes I do have an algorithm to calculate exact position). Here's XML code for scrolling tab buttons <HorizontalScrollView android:layout_width="fill_parent" android:background="@color/tabs_header" android:layout_height="55dip" android:scrollbars="none" android:id="@+id/tabsButtonView"> <TableLayout android:id="@+id/TableLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="0dip" android:paddingTop="5dip" android:paddingLeft="3dip"> <ImageButton android:src="@drawable/linkup_logo_small" android:id="@+id/tabBtt0" android:layout_width="wrap_content" android:layout_marginLeft="2dip" android:layout_marginRight="2dip" android:layout_height="fill_parent" android:padding="5dip" android:background="@drawable/tab_selected"></ImageButton> <ImageButton android:src="@drawable/simplyhired_small" android:id="@+id/tabBtt1" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_marginLeft="2dip" android:layout_marginRight="2dip" android:padding="5dip" android:background="@drawable/tab_normal"></ImageButton> <ImageButton android:src="@drawable/indeedcom_small" android:id="@+id/tabBtt2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dip" android:layout_marginLeft="2dip" android:layout_marginRight="2dip" android:background="@drawable/tab_normal"></ImageButton> <ImageButton android:src="@drawable/careerbuilder_logo_small" android:id="@+id/tabBtt3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="5dip" android:layout_marginLeft="2dip" android:layout_marginRight="2dip" android:background="@drawable/tab_normal"></ImageButton> </TableRow> </TableLayout> </HorizontalScrollView>

    Read the article

  • JScrollPane and JList auto scroll

    - by dododedodonl
    Hi All, I've got the next code: listModel = new DefaultListModel(); listModel.addElement(dateFormat.format(new Date()) + ": Msg1"); messageList = new JList(listModel); messageList.setLayoutOrientation(JList.VERTICAL); messageScrollList = new JScrollPane(messageList); messageScrollList.setPreferredSize(new Dimension(500, 200)); messageScrollList.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { e.getAdjustable().setValue(e.getAdjustable().getMaximum()); } }); It auto scrolls down. But, if I try to scroll back up to re-read a message, it forces a scroll down. How can I fix this?

    Read the article

  • ExtJs Grid in TabPanel auto Fit issue.

    - by Jinah Adam
    Hi, I am having problems redering an grid in a a tab panel (Its made with Ext Designer.). the hierarchy is as follows , Viewport. - tabPanel - Panel - Container - Grid. This is how its displayed now Here is the code for viewport mainWindowUi = Ext.extend(Ext.Viewport, { layout: 'border', id: 'mainWindow', initComponent: function() { this.items = [ { xtype: 'panel', title: 'Navigation', region: 'west', width: 200, frame: true, split: true, titleCollapse: true, collapsible: true, id: 'navigation', items: [ { flex: 1, xtype: 'mytreepanel' } ] }, { xtype: 'tabpanel', layoutOnTabChange: true, resizeTabs: true, defaults: { layout: 'fit', autoScroll: true }, region: 'center', tpl: '', id: 'mainTabPanel', layoutConfig: { deferredRender: true } } ]; mainWindowUi.superclass.initComponent.call(this); } }); here is the code to create the tab.. (created from a nav panel programmatically) var currentTab = tabPanel.findById(node.id); // If not yet created, create the tab if (!currentTab){ currentTab = tabPanel.add({ title:node.id, id:node.id, closable:true, items:[{ xtype: 'phasePanel', layout: 'fit', autoscroll: true, }], autoScroll:true, }); } // Activate tab tabPanel.setActiveTab(currentTab); here is the code for the panel/container/grid PhasePanelUi = Ext.extend(Ext.Panel, { frame: true, layout: 'anchor', autoScroll: true, autoWidth: true, defaults: '', initComponent: function() { this.items = [ { xtype: 'container', autoScroll: true, layout: 'fit', defaults: { layout: 'fit', autoScroll: true }, id: 'gridHolder', items: [ { xtype: 'grid', title: 'Current Phases', store: 'PhaseStore', autoDestroy: false, viewConfig: '', deferRowRender: false, autoLoad: '', ref: '../phaseGrid', id: 'phaseGrid', columns: [ { xtype: 'gridcolumn', header: 'Name', dataIndex: 'name', sortable: true, width: 200 }, { xtype: 'gridcolumn', header: 'Estate', dataIndex: 'estate_name', sortable: true, width: 500 } ] } ] } ]; PhasePanelUi.superclass.initComponent.call(this); } }); i have tried all sorts of combinations. but just cant get the grid to render correctly any sort of assistance will be appreciated.

    Read the article

  • Any way to disable horizontal scroll for FlowLayoutPanel in AutoScroll mode?

    - by P a u l
    I need a System.Windows.Forms.FlowLayoutPanel that only auto scrolls vertically. WrapContents is false, and I want it to work like a vertical stack panel. I can't find a way to disable the horizontal scroll. I've googled it, can't find a usable solution so far. The alternative is to abandon the FlowLayoutPanel, and try another control. What acts somewhat like a WPF stack panel but that expands and shrinks vertically with the contained controls?

    Read the article

  • How do I get textbox to fill the column and autoscroll?

    - by Stephen Price
    I have the following code in my DataGridTemplateColumn: <Controls:DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBox Text="{Binding AlternateTeacherName, Mode=TwoWay}" Style="{StaticResource InputTextBox}"/> </StackPanel> </DataTemplate> Style is: <Style x:Key="InputTextBox" TargetType="TextBox" > <Setter Property="Margin" Value="1" /> <Setter Property="MinWidth" Value="30" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="TextAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Stretch" /> Problem I'm getting is that the textbox fills the column width correctly (including when you resize it) but if I type into the textbox the cursor is not visible when it reaches the end of the line. I'd like the text to scroll off the left so that the current text is still visible. thanks

    Read the article

  • ExtJs - Set a fixed width in a center layout in a Panel

    - by Benjamin
    Hi all, Using ExtJs. I'm trying to design a main which is divided into three sub panels (a tree list, a grid and a panel). The way it works is that you have a tree list (west) with elements, you click on an element which populates the grid (center), then you click on an element in the grid and that generates the panel (west). My main panel containing the three other ones has been defined with a layout 'border'. Now the problem I face is that the center layout (the grid) has been defined in the code with a fixed width and the west panel as an auto width. But when the interface gets generated, the grid width is suddenly taking all the space in the interface instead of the west panel. The code looks like that: var exploits_details_panel = new Ext.Panel({ region: 'east', autoWidth: true, autoScroll: true, html: 'test' }); var exploit_commands = new Ext.grid.GridPanel({ store: new Ext.data.Store({ autoDestroy: true }), sortable: true, autoWidth: false, region: 'center', stripeRows: true, autoScroll: true, border: true, width: 225, columns: [ {header: 'command', width: 150, sortable: true}, {header: 'date', width: 70, sortable: true} ] }); var exploits_tree = new Ext.tree.TreePanel({ border: true, region: 'west', width: 200, useArrows: true, autoScroll: true, animate: true, containerScroll: true, rootVisible: false, root: {nodeType: 'async'}, dataUrl: '/ui/modules/select/exploits/tree', listeners: { 'click': function(node) { } } }); var exploits = new Ext.Panel({ id: 'beef-configuration-exploits', title: 'Auto-Exploit', region: 'center', split: true, autoScroll: true, layout: { type: 'border', padding: '5', align: 'left' }, items: [exploits_tree, exploit_commands, exploits_details_panel] }); Here 'var exploits' is my main panel containing the three other sub panels. The 'exploits_tree' is the tree list containing some elements. When you click on one of the elements the grid 'exploit_commands' gets populated and when you click in one of the populated elements, the 'exploits_details_panel' panel gets generated. How can I set a fixed width on 'exploit_commands'? Thanks for your time.

    Read the article

  • Ext JS Tab Panel - Dynamic Tabs - Tab Exists Not Working

    - by Joey Ezekiel
    Hi Would appreciate if somebody could help me on this. I have a Tree Panel whose nodes when clicked load a tab into a tab panel. The tabs are loading alright, but my problem is duplication. I need to check if a tab exists before adding it to the tab panel. I cant seem to have this resolved and it is eating my brains. This is pretty simple and I have checked stackoverflow and the EXT JS Forums for solutions but they dont seem to work for me or I'm being blind. This is my code for the tree: var opstree = new Ext.tree.TreePanel({ renderTo: 'opstree', border:false, width: 250, height: 'auto', useArrows: false, animate: true, autoScroll: true, dataUrl: 'libs/tree-data.json', root: { nodeType: 'async', text: 'Tool Actions' }, listeners: { render: function() { this.getRootNode().expand(); } } }) opstree.on('click', function(n){ var sn = this.selModel.selNode || {}; // selNode is null on initial selection renderPage(n.id); }); function renderPage(tabId) { var TabPanel = Ext.getCmp('content-tab-panel'); var tab = TabPanel.getItem(tabId); //Ext.MessageBox.alert('TabGet',tab); if(tab){ TabPanel.setActiveTab(tabId); } else{ TabPanel.add({ title: tabId, html: 'Tab Body ' + (tabId) + '', closable:true }).show(); TabPanel.doLayout(); } } }); and this is the code for the Tab Panel new Ext.TabPanel({ id:'content-tab-panel', region: 'center', deferredRender: false, enableTabScroll:true, activeTab: 0, items: [{ contentEl: 'about', title: 'About the Billing Ops Application', closable: true, autoScroll: true, margins: '0 0 0 0' },{ contentEl: 'welcomescreen', title: 'PBRT Application Home', closable: false, autoScroll: true, margins: '0 0 0 0' }] }) Can somebody please help?

    Read the article

  • c# winforms - scrollable panel with rectangles

    - by Peanut
    Hi, I'm new to winforms and have tried to track down an answer to the following with no luck ... I have a panel in winforms and add to it a Rectangle that is wider than the panel itself. I've set the panel AutoScroll property to true however the panels horizontal scrollbar never appears. Why is this? And how do I get the scrollbar to scroll? Here is my code to add the rectangle: private void panel1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Rectangle rec = new Rectangle(2, 2, 400, 40); g.DrawRectangle(new Pen(Color.Black), rec); g.FillRectangle(new SolidBrush(Color.Blue), rec); } If I add a Label control to the panel and give it a text value that will go beyond the bounds of the panel - then the autoscroll works, but just not for a rectangle. Many thanks.

    Read the article

  • Adding scrollbars to UserControl

    - by Bevin
    I am trying to add vertical and horizontal scrollbars to my UserControl with the HorizontalScroll and VerticalScroll properties, but I am having extreme issues. My problem arises when I drag or manipulate the scroll box on the bar. When I let it go, it simply jumps back to the start position! I know of the AutoScroll property, but I do not want to use it since I want to be able to control every aspect of my scrollbars, and I don't want it to be done automatically. Also, according to the documentation, AutoScroll is for "[enabling] the user to scroll to any controls placed outside of its visible boundaries" which isn't what I want. I just want scrollbars. ...aaand I suppose I could add VScrollBar and HScrollBar to the control, but why should I do this when the scroll functionality already exists? Seems like a waste to me.

    Read the article

  • Combo box in a scrollable panel causing problems

    - by Dennis
    I have a panel with AutoScroll set to true. In it, I am programmatically adding ComboBox controls. If I add enough controls to exceed the viewable size of the panel a scroll bar appears (so far so good). However, if I open one of the combo boxes near the bottom of the viewable area the combo list isn't properly displayed and the scrollable area seems to be expanded. This results in all of the controls being "pulled" to the new bottom of the panel with some new blank space at the top. If I continue to tap on the drop down at the bottom of the panel the scrollable area will continue to expand indefinitely. I'm anchoring the controls to the left, right and top so I don't think anchoring is involved. Is there something obvious that could be causing this? Update: It looks like the problem lies with anchoring the controls to the right. If I don't anchor to the right then I don't get the strange behavior. However, without right anchoring the control gets cut off by the scroll bar. Here's a simplified test case I built that shows the issue: public Form1() { InitializeComponent(); Panel panel = new Panel(); panel.Size = new Size(80, 200); panel.AutoScroll = true; for (int i = 0; i < 10; ++i) { ComboBox cb = new ComboBox(); cb.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; cb.Items.Add("Option 1"); cb.Items.Add("Option 2"); cb.Items.Add("Option 3"); cb.Items.Add("Option 4"); cb.Location = new Point(0, i * 24); panel.Controls.Add(cb); } Controls.Add(panel); } If you scroll the bottom of the panel and tap on the combo boxes near the bottom you'll notice the strange behavior.

    Read the article

  • Fitting an Image to Screen on Rotation iPhone / iPad ?

    - by user356937
    I have been playing around with one of the iPhone examples from Apple' web site (ScrollViewSuite) . I am trying to tweak it a bit so that when I rotate the the iPad the image will fit into the screen in landscape mode vertical. I have been successful in getting the image to rotate, but the image is larger than the height of the landscape screen, so the bottom is below the screen. I would like to image to scale to the height of the landscape screen. I have been playing around with various autoSizingMask attributes without success. The imageView is called "zoomView" this is the actual image which loads into a scrollView called imageScrollView. I am trying to achieve the screen to rotate and look like this.... olsonvox.com/photos/correct.png However, this is what My screen is looking like. olsonvox.com/photos/incorrect.png I would really appreciate some advice or guidance. Below is the RootViewController.m for the project. Blade # import "RootViewController.h" #define ZOOM_VIEW_TAG 100 #define ZOOM_STEP 1.5 #define THUMB_HEIGHT 150 #define THUMB_V_PADDING 25 #define THUMB_H_PADDING 25 #define CREDIT_LABEL_HEIGHT 25 #define AUTOSCROLL_THRESHOLD 30 @interface RootViewController (ViewHandlingMethods) - (void)toggleThumbView; - (void)pickImageNamed:(NSString *)name; - (NSArray *)imageNames; - (void)createThumbScrollViewIfNecessary; - (void)createSlideUpViewIfNecessary; @end @interface RootViewController (AutoscrollingMethods) - (void)maybeAutoscrollForThumb:(ThumbImageView *)thumb; - (void)autoscrollTimerFired:(NSTimer *)timer; - (void)legalizeAutoscrollDistance; - (float)autoscrollDistanceForProximityToEdge:(float)proximity; @end @interface RootViewController (UtilityMethods) - (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center; @end @implementation RootViewController - (void)loadView { [super loadView]; imageScrollView = [[UIScrollView alloc] initWithFrame:[[self view]bounds]]; // this code makes the image resize to the width and height properly. imageScrollView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin| UIViewAutoresizingFlexibleBottomMargin| UIViewAutoresizingFlexibleBottomMargin; // TRY SETTNG CENTER HERE SOMEHOW&gt;.... [imageScrollView setBackgroundColor:[UIColor blackColor]]; [imageScrollView setDelegate:self]; [imageScrollView setBouncesZoom:YES]; [[self view] addSubview:imageScrollView]; [self toggleThumbView]; // intitializes with the first image. [self pickImageNamed:@"lookbook1"]; } - (void)dealloc { [imageScrollView release]; [slideUpView release]; [thumbScrollView release]; [super dealloc]; } #pragma mark UIScrollViewDelegate methods - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { UIView *view = nil; if (scrollView == imageScrollView) { view = [imageScrollView viewWithTag:ZOOM_VIEW_TAG]; } return view; } /************************************** NOTE **************************************/ /* The following delegate method works around a known bug in zoomToRect:animated: */ /* In the next release after 3.0 this workaround will no longer be necessary */ /**********************************************************************************/ - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale { [scrollView setZoomScale:scale+0.01 animated:NO]; [scrollView setZoomScale:scale animated:NO]; } #pragma mark TapDetectingImageViewDelegate methods - (void)tapDetectingImageView:(TapDetectingImageView *)view gotSingleTapAtPoint:(CGPoint)tapPoint { // Single tap shows or hides drawer of thumbnails. [self toggleThumbView]; } - (void)tapDetectingImageView:(TapDetectingImageView *)view gotDoubleTapAtPoint:(CGPoint)tapPoint { // double tap zooms in float newScale = [imageScrollView zoomScale] * ZOOM_STEP; CGRect zoomRect = [self zoomRectForScale:newScale withCenter:tapPoint]; [imageScrollView zoomToRect:zoomRect animated:YES]; } - (void)tapDetectingImageView:(TapDetectingImageView *)view gotTwoFingerTapAtPoint:(CGPoint)tapPoint { // two-finger tap zooms out float newScale = [imageScrollView zoomScale] / ZOOM_STEP; CGRect zoomRect = [self zoomRectForScale:newScale withCenter:tapPoint]; [imageScrollView zoomToRect:zoomRect animated:YES]; } #pragma mark ThumbImageViewDelegate methods - (void)thumbImageViewWasTapped:(ThumbImageView *)tiv { [self pickImageNamed:[tiv imageName]]; [self toggleThumbView]; } - (void)thumbImageViewStartedTracking:(ThumbImageView *)tiv { [thumbScrollView bringSubviewToFront:tiv]; } // CONTROLS DRAGGING AND DROPPING THUMBNAILS... - (void)thumbImageViewMoved:(ThumbImageView *)draggingThumb { // check if we've moved close enough to an edge to autoscroll, or far enough away to stop autoscrolling [self maybeAutoscrollForThumb:draggingThumb]; /* The rest of this method handles the reordering of thumbnails in the thumbScrollView. See */ /* ThumbImageView.h and ThumbImageView.m for more information about how this works. */ // we'll reorder only if the thumb is overlapping the scroll view if (CGRectIntersectsRect([draggingThumb frame], [thumbScrollView bounds])) { BOOL draggingRight = [draggingThumb frame].origin.x &gt; [draggingThumb home].origin.x ? YES : NO; /* we're going to shift over all the thumbs who live between the home of the moving thumb */ /* and the current touch location. A thumb counts as living in this area if the midpoint */ /* of its home is contained in the area. */ NSMutableArray *thumbsToShift = [[NSMutableArray alloc] init]; // get the touch location in the coordinate system of the scroll view CGPoint touchLocation = [draggingThumb convertPoint:[draggingThumb touchLocation] toView:thumbScrollView]; // calculate minimum and maximum boundaries of the affected area float minX = draggingRight ? CGRectGetMaxX([draggingThumb home]) : touchLocation.x; float maxX = draggingRight ? touchLocation.x : CGRectGetMinX([draggingThumb home]); // iterate through thumbnails and see which ones need to move over for (ThumbImageView *thumb in [thumbScrollView subviews]) { // skip the thumb being dragged if (thumb == draggingThumb) continue; // skip non-thumb subviews of the scroll view (such as the scroll indicators) if (! [thumb isMemberOfClass:[ThumbImageView class]]) continue; float thumbMidpoint = CGRectGetMidX([thumb home]); if (thumbMidpoint &gt;= minX &amp;&amp; thumbMidpoint &lt;= maxX) { [thumbsToShift addObject:thumb]; } } // shift over the other thumbs to make room for the dragging thumb. (if we're dragging right, they shift to the left) float otherThumbShift = ([draggingThumb home].size.width + THUMB_H_PADDING) * (draggingRight ? -1 : 1); // as we shift over the other thumbs, we'll calculate how much the dragging thumb's home is going to move float draggingThumbShift = 0.0; // send each of the shifting thumbs to its new home for (ThumbImageView *otherThumb in thumbsToShift) { CGRect home = [otherThumb home]; home.origin.x += otherThumbShift; [otherThumb setHome:home]; [otherThumb goHome]; draggingThumbShift += ([otherThumb frame].size.width + THUMB_H_PADDING) * (draggingRight ? 1 : -1); } // change the home of the dragging thumb, but don't send it there because it's still being dragged CGRect home = [draggingThumb home]; home.origin.x += draggingThumbShift; [draggingThumb setHome:home]; } } - (void)thumbImageViewStoppedTracking:(ThumbImageView *)tiv { // if the user lets go of the thumb image view, stop autoscrolling [autoscrollTimer invalidate]; autoscrollTimer = nil; } #pragma mark Autoscrolling methods - (void)maybeAutoscrollForThumb:(ThumbImageView *)thumb { autoscrollDistance = 0; // only autoscroll if the thumb is overlapping the thumbScrollView if (CGRectIntersectsRect([thumb frame], [thumbScrollView bounds])) { CGPoint touchLocation = [thumb convertPoint:[thumb touchLocation] toView:thumbScrollView]; float distanceFromLeftEdge = touchLocation.x - CGRectGetMinX([thumbScrollView bounds]); float distanceFromRightEdge = CGRectGetMaxX([thumbScrollView bounds]) - touchLocation.x; if (distanceFromLeftEdge &lt; AUTOSCROLL_THRESHOLD) { autoscrollDistance = [self autoscrollDistanceForProximityToEdge:distanceFromLeftEdge] * -1; // if scrolling left, distance is negative } else if (distanceFromRightEdge &lt; AUTOSCROLL_THRESHOLD) { autoscrollDistance = [self autoscrollDistanceForProximityToEdge:distanceFromRightEdge]; } } // if no autoscrolling, stop and clear timer if (autoscrollDistance == 0) { [autoscrollTimer invalidate]; autoscrollTimer = nil; } // otherwise create and start timer (if we don't already have a timer going) else if (autoscrollTimer == nil) { autoscrollTimer = [NSTimer scheduledTimerWithTimeInterval:(1.0 / 60.0) target:self selector:@selector(autoscrollTimerFired:) userInfo:thumb repeats:YES]; } } - (float)autoscrollDistanceForProximityToEdge:(float)proximity { // the scroll distance grows as the proximity to the edge decreases, so that moving the thumb // further over results in faster scrolling. return ceilf((AUTOSCROLL_THRESHOLD - proximity) / 5.0); } - (void)legalizeAutoscrollDistance { // makes sure the autoscroll distance won't result in scrolling past the content of the scroll view float minimumLegalDistance = [thumbScrollView contentOffset].x * -1; float maximumLegalDistance = [thumbScrollView contentSize].width - ([thumbScrollView frame].size.width + [thumbScrollView contentOffset].x); autoscrollDistance = MAX(autoscrollDistance, minimumLegalDistance); autoscrollDistance = MIN(autoscrollDistance, maximumLegalDistance); } - (void)autoscrollTimerFired:(NSTimer*)timer { [self legalizeAutoscrollDistance]; // autoscroll by changing content offset CGPoint contentOffset = [thumbScrollView contentOffset]; contentOffset.x += autoscrollDistance; [thumbScrollView setContentOffset:contentOffset]; // adjust thumb position so it appears to stay still ThumbImageView *thumb = (ThumbImageView *)[timer userInfo]; [thumb moveByOffset:CGPointMake(autoscrollDistance, 0)]; } #pragma mark View handling methods - (void)toggleThumbView { [self createSlideUpViewIfNecessary]; // no-op if slideUpView has already been created CGRect frame = [slideUpView frame]; if (thumbViewShowing) { frame.origin.y = 0; } else { frame.origin.y = -225; } [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; [slideUpView setFrame:frame]; [UIView commitAnimations]; thumbViewShowing = !thumbViewShowing; } - (void)pickImageNamed:(NSString *)name { // first remove previous image view, if any [[imageScrollView viewWithTag:ZOOM_VIEW_TAG] removeFromSuperview]; UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@.jpg", name]]; TapDetectingImageView *zoomView = [[TapDetectingImageView alloc] initWithImage:image]; zoomView.autoresizingMask = UIViewAutoresizingFlexibleWidth ; [zoomView setDelegate:self]; [zoomView setTag:ZOOM_VIEW_TAG]; [imageScrollView addSubview:zoomView]; [imageScrollView setContentSize:[zoomView frame].size]; [zoomView release]; // choose minimum scale so image width fits screen float minScale = [imageScrollView frame].size.width / [zoomView frame].size.width; [imageScrollView setMinimumZoomScale:minScale]; [imageScrollView setZoomScale:minScale]; [imageScrollView setContentOffset:CGPointZero]; } - (NSArray *)imageNames { // the filenames are stored in a plist in the app bundle, so create array by reading this plist NSString *path = [[NSBundle mainBundle] pathForResource:@"Images" ofType:@"plist"]; NSData *plistData = [NSData dataWithContentsOfFile:path]; NSString *error; NSPropertyListFormat format; NSArray *imageNames = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&amp;format errorDescription:&amp;error]; if (!imageNames) { NSLog(@"Failed to read image names. Error: %@", error); [error release]; } return imageNames; } - (void)createSlideUpViewIfNecessary { if (!slideUpView) { [self createThumbScrollViewIfNecessary]; CGRect bounds = [[self view] bounds]; float thumbHeight = [thumbScrollView frame].size.height; float labelHeight = CREDIT_LABEL_HEIGHT; // create label giving credit for images UILabel *creditLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, thumbHeight, bounds.size.width, labelHeight)]; [creditLabel setBackgroundColor:[UIColor clearColor]]; [creditLabel setTextColor:[UIColor whiteColor]]; // [creditLabel setFont:[UIFont fontWithName:@"Helvetica" size:16]]; // [creditLabel setText:@"SAMPLE TEXT"]; [creditLabel setTextAlignment:UITextAlignmentCenter]; // create container view that will hold scroll view and label CGRect frame = CGRectMake(0.0, -225.00, bounds.size.width+256, thumbHeight + labelHeight); slideUpView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; slideUpView = [[UIView alloc] initWithFrame:frame]; [slideUpView setBackgroundColor:[UIColor blackColor]]; [slideUpView setOpaque:NO]; [slideUpView setAlpha:.75]; [[self view] addSubview:slideUpView]; // add subviews to container view [slideUpView addSubview:thumbScrollView]; [slideUpView addSubview:creditLabel]; [creditLabel release]; } } - (void)createThumbScrollViewIfNecessary { if (!thumbScrollView) { float scrollViewHeight = THUMB_HEIGHT + THUMB_V_PADDING; float scrollViewWidth = [[self view] bounds].size.width; thumbScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, scrollViewWidth, scrollViewHeight)]; [thumbScrollView setCanCancelContentTouches:NO]; [thumbScrollView setClipsToBounds:NO]; // now place all the thumb views as subviews of the scroll view // and in the course of doing so calculate the content width float xPosition = THUMB_H_PADDING; for (NSString *name in [self imageNames]) { UIImage *thumbImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_thumb.jpg", name]]; if (thumbImage) { ThumbImageView *thumbView = [[ThumbImageView alloc] initWithImage:thumbImage]; [thumbView setDelegate:self]; [thumbView setImageName:name]; CGRect frame = [thumbView frame]; frame.origin.y = THUMB_V_PADDING; frame.origin.x = xPosition; [thumbView setFrame:frame]; [thumbView setHome:frame]; [thumbScrollView addSubview:thumbView]; [thumbView release]; xPosition += (frame.size.width + THUMB_H_PADDING); } } [thumbScrollView setContentSize:CGSizeMake(xPosition, scrollViewHeight)]; } } #pragma mark Utility methods - (CGRect)zoomRectForScale:(float)scale withCenter:(CGPoint)center { CGRect zoomRect; // the zoom rect is in the content view's coordinates. // At a zoom scale of 1.0, it would be the size of the imageScrollView's bounds. // As the zoom scale decreases, so more content is visible, the size of the rect grows. zoomRect.size.height = [imageScrollView frame].size.height / scale; zoomRect.size.width = [imageScrollView frame].size.width / scale; // choose an origin so as to get the right center. zoomRect.origin.x = center.x - (zoomRect.size.width / 2.0); zoomRect.origin.y = center.y - (zoomRect.size.height / 2.0); return zoomRect; } #pragma mark - #pragma mark Rotation support // Ensure that the view controller supports rotation and that the split view can therefore show in both portrait and landscape. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } @end

    Read the article

  • Hide 'Your profile could not be opened correctly'

    - by B. Roland
    Hello! I have a small public internet cafe, with Ubuntu 10.04 and 10.10. I'm using Google Chrome 7.0.517.44 (64615), with AutoScroll - Version: 2.7.5; AdBlock is removed because of high CPU loads, and unconfortable speed of machine. "Your profile could not be opened correctly" error is displayed: This image is only an illustration. The reason is that I changed permissions of some config files, to don't remember the history, there are no setting in options, to don't use history. I've been removed write permission to: ~/.config/google-chrome$ find . -group nopasswdlogin ./Default/Archived History ./Default/History ./Default/Visited Links When I solved all of my problem, I'll remove some other write permission, this is a public place. What methods are known to HIDE this message? Thanks!

    Read the article

1 2 3  | Next Page >