Search Results

Search found 1164 results on 47 pages for 'labels'.

Page 37/47 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • Getting data from UITableView

    - by Tejaswi Yerukalapudi
    Hi, I have a few custom UITableViewCells - http://img11.imageshack.us/i/customfacilitiescell.png/ which are added to this UIViewController - http://img189.imageshack.us/i/facilitycontroller.png/ Now, on clicking a button in the controller, I'd like to get the on/off status of all the UISwitches in the controller. Thanks, Teja Edit: I've made a few edits, but I still can't figure out how to do this. My program structure currently - A CustomCell.xib that looks like this - http://img11.imageshack.us/i/customfacilitiescell.png/ A CustomCellController that a subclass of UITableViewCell that has the IBOutlets for the labels and switches from above. Now I have a UIViewController<UITableViewDataSource, UITableViewDelegate> (Say, Screen1Controller) which looks like - http://img189.imageshack.us/i/facilitycontroller.png/ The tableviewcell is being created like this - - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *Id= @"CustomFacilitiesCell"; CustomFacilitiesCellController *cell = (CustomFacilitiesCellController *)[tableView dequeueReusableCellWithIdentifier:Id]; if(cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomFacilitiesCell" owner:self options:nil]; for (id oneObject in nib) { if([oneObject isKindOfClass:[CustomFacilitiesCellController class]]) cell = (CustomFacilitiesCellController *) oneObject; } } NSUInteger row = [indexPath row]; CustomFacilitiesCellController *rowData = (CustomFacilitiesCellController *)[self.facilities objectAtIndex:row]; cell.facname.text = rowData.facname.text; cell.FacID.text = rowData.FacID.text; cell.facSwitch = [(CustomFacilitiesCellController *)rowData facSwitch]; UISwitch *temp = cell.facSwitch; [(UISwitch *)[cell facSwitch] addTarget:self action:@selector(facSwitchOptionChanged:) forControlEvents:UIControlEventValueChanged]; cell.facSwitch.on = NO; //cell.facSwitch.enabled = FALSE; cell.accessoryType = UITableViewCellAccessoryNone; return cell; } - (IBAction) facSwitchOptionChanged:(id) sender { int i=0; } In particular, my problem is that the facSwitchOptionChanged() isn't getting called. Thanks again for the help, Teja.

    Read the article

  • Drawing custom graphics on the iPhone: CALayer vs. CGContext

    - by Henry Cooke
    Hi all, I have an application in which I'm doing some custom drawing, a bunch of lines on a gradient background, like so (ignore the text, they're just UILabels): At the moment, that's all done by starting a new CGContext, drawing stuff into it with CGContextDrawLinearGradient and CGContextStrokePath, then finally saving the resulting image with UIGraphicsGetImageFromCurrentImageContext. The positioning info is calculated while I'm laying out those labels, so it'd be a PITA (and duplication of effort) to calculate it all over again when the containing UIView is drawn with drawRect, so I'm drawing it ahead of time into a UIImage. All works fine, so far so good. However, I have a sneaking suspicion that it may be more efficient to use CALayers to do this drawing. My (cursory) understanding of the difference between the two approaches is that a CALayer is more like a bunch of instructions to draw stuff, and so takes up less memory until it's actually drawn onscreen, whereas drawing everything into a UIImage ahead of time means that you've got a sodding great bitmap kicking around in memory all the time, whether it's drawn or not. Is that a correct understanding? What is generally considered to be the best way of drawing custom images on the iPhone?

    Read the article

  • How create a Firefox-like search textbox in WPF?

    - by Simon
    Hey there. I'm writing an application in WPF using the MVVM-pattern and will really often use TextBoxes. I don't want to use labels for the user to know user what the text box is for, i.e. I don't want something like this: <TextBlock> Name: </TextBlock> <TextBox /> Instead, I would like the TextBox to contain its own label. Statically, you would express it like this: <TextBox>Name</TextBox> If the cursor is displayed in the textbox, i.e. the TextBox gains focus, I want the description text to disappear. If the TextBox is left empty and it loses the focus, the description text should be shown again. It's similar to the search textbox of StackOverflow or the one of Firefox. (please tell me if your not sure what I mean). One TextBox's label may change at runtime, dependending on e.g. a ComboBox's selected element or a value in my ViewModel. (It's like in Firefox's search TextBox, if you select google from the search engins' menu, the TextBox's label changes to "Google", if you select "Yahoo" its set to "Yahoo"). Thus I want to be able to bind the label's content. Consider that I may already have a Binding on the Text-Property of the TextBox. How can implement such a behaviour and make it reusable for any of my TextBox's? Code is welcome but not needed; a description of what to do is enough. Thank you in advance.

    Read the article

  • C# update GUI continuously from backgroundworker.

    - by Qrew
    I have created a GUI (winforms) and added a backgroundworker to run in a separate thread. The backgroundworker needs to update 2 labels continuously. The backgroundworker thread should start with button1 click and run forever. class EcuData { public int RPM { get; set; } public int MAP { get; set; } } private void button1_Click(object sender, EventArgs e) { EcuData data = new EcuData { RPM = 0, MAP = 0 }; BackWorker1.RunWorkerAsync(data); } private void BackWorker1_DoWork(object sender, DoWorkEventArgs e) { EcuData argumentData = e.Argument as EcuData; int x = 0; while (x<=10) { // // Code for reading in data from hardware. // argumentData.RPM = x; //x is for testing only! argumentData.MAP = x * 2; //x is for testing only! e.Result = argumentData; Thread.Sleep(100); x++; } private void BackWorker1_RunWorkerCompleted_1(object sender, RunWorkerCompletedEventArgs e) { EcuData data = e.Result as EcuData; label1.Text = data.RPM.ToString(); label2.Text = data.MAP.ToString(); } } The above code just updated the GUI when backgroundworker is done with his job, and that's not what I'm looking for.

    Read the article

  • JQGrid: Dropdown for selecting items from a foreign table - DataValueField vs DataTextField

    - by Herb Caudill
    Suppose Items and ItemTypes have numeric primary keys ItemID and ItemTypeID. Each Item is assigned an ItemType. I have a JQGrid to edit Items. When not in edit mode, I would like to see the name of the ItemType, not the ItemTypeID: TYPE | TITLE -----------+-------------------- Category A | Item 1 Category A | Item 2 Category B | Item 3 Category B | Item 4 In edit mode, I want to see a dropdown that displays the ItemType text, but that returns the ItemTypeID to the server. Here's what I have so far (using the ASP.NET wrapper for JQGrid): <trirand:jqgrid id="Grid1" runat="server" ... > <columns> <trirand:jqgridcolumn datafield="ItemID" editable="false" visible="false" width="50" primarykey="true" /> <trirand:jqgridcolumn datafield="ItemTypeID" editable="true" edittype="DropDown" editorcontrolid="ItemTypes" /> <trirand:jqgridcolumn datafield="Title" editable="true" sortable="true" /> ... </columns> </trirand:jqgrid> <asp:sqldatasource runat="server" id="ItemTypesDatasource" connectionstring="<%$ ConnectionStrings:Main %>" selectcommand="Select ItemTypeID,Title from ItemTypes order by Title" /> <asp:dropdownlist runat="server" id="ItemTypes" datasourceid="ItemTypesDatasource" datavaluefield="ItemTypeID" datatextfield="Title" /> The problem is that when not in edit mode, it displays the numeric ItemTypeID, rather than the text labels: TYPE | TITLE -----------+-------------------- 100123 | Item 1 100123 | Item 2 100124 | Item 3 100124 | Item 4 Is there any way to have JQGrid respect the distinction between DataValueField and DataTextField? (Either using the jQuery API or the ASP.NET plugin.)

    Read the article

  • Label in PyQt4 GUI not updating with every loop of FOR loop

    - by user297920
    I'm having a problem, where I wish to run several command line functions from a python program using a GUI. I don't know if my problem is specific to PyQt4 or if it has to do with my bad use of python code. What I wish to do is have a label on my GUI change its text value to inform the user which command is being executed. My problem however, arises when I run several commands using a for loop. I would like the label to update itself with every loop, however, the program is not updating the GUI label with every loop, instead, it only updates itself once the entire loop is completed, and displays only the last command that was executed. I am using PyQt4 for my GUI environment. And I have established that the text variable for the label is indeed being updated with every loop, but, it is not actually showing up visually in the GUI. Is there a way for me to force the label to update itself? I have tried the update() and repaint() methods within the loop, but they don't make any difference. I would really appreciate any help. Thank you. Ronny. Here is the code I am using: # -*- coding: utf-8 -*- import sys, os from PyQt4 import QtGui, QtCore Gui = QtGui Core = QtCore # ================================================== CREATE WINDOW OBJECT CLASS class Win(Gui.QWidget): def __init__(self, parent = None): Gui.QWidget.__init__(self, parent) # --------------------------------------------------- SETUP PLAY BUTTON self.but1 = Gui.QPushButton("Run Commands",self) self.but1.setGeometry(10,10, 200, 100) # -------------------------------------------------------- SETUP LABELS self.label1 = Gui.QLabel("No Commands running", self) self.label1.move(10, 120) # ------------------------------------------------------- SETUP ACTIONS self.connect(self.but1, Core.SIGNAL("clicked()"), runCommands) # ======================================================= RUN COMMAND FUNCTION def runCommands(): for i in commands: win.label1.setText(i) # Make label display the command being run print win.label1.text() # This shows that the value is actually # changing with every loop, but its just not # being reflected in the GUI label os.system(i) # ======================================================================== MAIN # ------------------------------------------------------ THE TERMINAL COMMANDS com1 = "espeak 'senntence 1'" com2 = "espeak 'senntence 2'" com3 = "espeak 'senntence 3'" com4 = "espeak 'senntence 4'" com5 = "espeak 'senntence 5'" commands = (com1, com2, com3, com4, com5) # --------------------------------------------------- SETUP THE GUI ENVIRONMENT app = Gui.QApplication(sys.argv) win = Win() win.show() sys.exit(app.exec_())

    Read the article

  • Using nested error wrappers with jQuery validate plugin

    - by RyOnLife
    I am using the jQuery validate plugin. My error labels are styled like tooltips and take many levels of nested divs in order to create. The plugin has a wrapper option that allows for an element type to be specified as a wrapper for the error message, but it's only wrapped once. Is anyone familiar with how to do nested wrapping? This isn't my exact markup, but as an example: <div class="tooltip"> <div> <div> <span class="error">This field is required.</span> </div> </div> </div> * UPDATE * The response from Chris answers my original question, but creates a new problem. The errors are now being displayed as desired, but the plugin fails to clear them. When a failed validation passes, span.error is set to display:none, but the div.tooltip nested wrapper still displays.

    Read the article

  • Getting Error System.Runtime.InteropServices.COMException

    - by Savan Parmar
    Hey All, I am using Vb.Net to Create Labels in Microsoft. For that i am using below mantioend Code. Public Sub CreateLabel(ByVal StrFilter As String, ByVal Path As String) WordApp = CreateObject("Word.Application") ''Add a new document. WordDoc = WordApp.Documents.Add() Dim oConn As SqlConnection = New SqlConnection(connSTR) oConn.Open() Dim oCmd As SqlCommand Dim oDR As SqlDataReader oCmd = New SqlCommand(StrFilter, oConn) oDR = oCmd.ExecuteReader Dim intI As Integer Dim FilePath As String = "" With WordDoc.MailMerge With .Fields Do While oDR.Read For intI = 0 To oDR.FieldCount - 1 .Add(WordApp.Selection.Range, oDR.Item(intI)) Next Loop End With Dim objAutoText As Word.AutoTextEntry = WordApp.NormalTemplate.AutoTextEntries.Add("MyLabelLayout", WordDoc.Content) WordDoc.Content.Delete() .MainDocumentType = Word.WdMailMergeMainDocType.wdMailingLabels FilePath = CreateSource(StrFilter) .OpenDataSource(FilePath) Dim NewLabel As Word.CustomLabel = WordApp.MailingLabel.CustomLabels.Add("MyLabel", False) WordApp.MailingLabel.CreateNewDocument(Name:="MyLabel", Address:="", AutoText:="MyLabelLayout") objAutoText.Delete() .Destination = Word.WdMailMergeDestination.wdSendToNewDocument WordApp.Visible = True .Execute() End With oConn.Close() WordDoc.Close() End Sub Private Function CreateSource(ByVal StrFilter As String) As String Dim CnnUser As SqlConnection = New SqlConnection(connSTR) Dim sw As StreamWriter = File.CreateText("C:\Mail.Txt") Dim Path As String = "C:\Mail.Txt" Dim StrHeader As String = "" Try Dim SelectCMD As SqlCommand = New SqlCommand(StrFilter, CnnUser) Dim oDR As SqlDataReader Dim IntI As Integer SelectCMD.CommandType = CommandType.Text CnnUser.Open() oDR = SelectCMD.ExecuteReader For IntI = 0 To oDR.FieldCount - 1 StrHeader &= oDR.GetName(IntI) & " ," Next StrHeader = Mid(StrHeader, 1, Len(StrHeader) - 2) sw.WriteLine(StrHeader) sw.Flush() sw.Close() StrHeader = "" Do While oDR.Read For IntJ As Integer = 0 To oDR.FieldCount - 1 StrHeader &= oDR.GetString(IntJ) & " ," Next Loop StrHeader = Mid(StrHeader, 1, Len(StrHeader) - 2) sw = File.AppendText(Path) sw.WriteLine(StrHeader) CnnUser.Close() sw.Flush() sw.Close() Catch ex As Exception MessageBox.Show(ex.Message, "TempID", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try Return Path End Function Now when i am running the programm i am getting this error.I tried hard but not able to locate what could be the problem the error is:- System.Runtime.InteropServices.COMException --Horizontal and vertical pitch must be greater than or equal to the label width and height, respectively. Even though i tried to set the Horizontal and vertical pitch programatically but it gives same err. Plz if any one can help

    Read the article

  • Write XML using best way(Linq To XML or other)

    - by Pankaj
    Hello All I want to write my xml with following format. How can i do it?I am using c# <map borderColor='c5e5b8' fillColor='6a9057' numberSuffix=' Mill.' includeValueInLabels='0' labelSepChar=': ' baseFontSize='9' showFCMenuItem='0' hoverColor='c2bc23' showTitle='0' type='0' showCanvasBorder='0' bgAlpha='0,0' hoveronEmpty='1' includeNameInLabels='0' showLabels='1'> <!--toolText='Alaska'imageSave='1' imageSaveURL='Path/FusionChartsSave.aspx or FusionChartsSave.php'--> <data> <entity id='AL' value='AL' link="JavaScript:FilterClientProjectList('AL');" fontBold='1' showLabel='0' /> <entity id='AK' value='AK' link="JavaScript:FilterClientProjectList('AK');" fontBold='1' hoverColor='6a9057'/> <entity id='AZ' value='AZ' link="JavaScript:FilterClientProjectList('AZ');" fontBold='1'/> </data> <styles> <definition> <style name='MyFirstFontStyle' type='font' face='Verdana' size='11' color='0372AB' bold='1' bgColor='FFFFFF' /> </definition> <application> <apply toObject='Labels' styles='' /> </application> </styles> </map> Thanks in advance..

    Read the article

  • Problems with Aero Glass in Delphi 7 applications

    - by Cralias
    Hi everyone! I'm trying to remake some of my older projects to support Aero Glass. Although it's kinda easy to enable glass frame, I've encountered some major problems. I used this code: var xVer: TOSVersionInfo; hDWM: THandle; DwmIsCompositionEnabled: function(pbEnabled: BOOL): HRESULT; stdcall; DwmExtendFrameIntoClientArea: function(hWnd: HWND; const pxMarInset: PRect): HRESULT; stdcall; bEnabled: BOOL; xFrame: TRect; // ... xVer.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); GetVersionEx(xVer); if xVer.dwMajorVersion >= 6 then begin hDWM := LoadLibrary('dwmapi.dll'); @DwmIsCompositionEnabled := GetProcAddress(hDWM, 'DwmIsCompositionEnabled'); @DwmExtendFrameIntoClientArea := GetProcAddress(hDWM, 'DwmExtendFrameIntoClientArea'); if (@DwmIsCompositionEnabled <> nil) and (@DwmExtendFrameIntoClientArea <> nil) then begin DwmIsCompositionEnabled(@bEnabled); if bEnabled then begin xRect := Rect(-1, -1, -1, -1); DwmExtendFrameIntoClientArea(FrmMain.Handle, @xRect); end; end; FreeLibrary(hDWM); end; So I got the pretty glass window now. Due to black being transparent color now (kinda stupid choice, why couldn't it be pink) anything that is clBlack becomes transparent, too. It means all labels, edits, button texts... even if I set text to some other color at design time, DWM still makes them that color AND transparent. Well, my question would be - whether it's possible to solve this somehow?

    Read the article

  • autoresizingMask changes the size of the UILabel being drawn, just by being set

    - by Kojiro
    I have some custom UITableViewCells that are made programmatically as needed, I want these to resize. However, when I add autoresizingMasks to the UILabels in the cells, they all seem to stretch wider while anchoring to the left side. // This works fine UILabel *aField = [[UILabel alloc] initWithFrame:CGRectMake(60, 2, tableView.frame.size.width - 83, 21)]; UILabel *bField = [[UILabel alloc] initWithFrame:CGRectMake(60, 20, tableView.frame.size.width - 154, 21)]; UILabel *cField = [[UILabel alloc] initWithFrame:CGRectMake(0, 2, tableView.frame.size.width, 21)]; UILabel *dField = [[UILabel alloc] initWithFrame:CGRectMake(tableView.frame.size.width - 116, 11, 93, 21)]; UILabel *eField = [[UILabel alloc] initWithFrame:CGRectMake(tableView.frame.size.width - 116, 11, 93, 21)]; // But when I add this, it draws like the tableview is actually much wider than it really is aField.autoresizingMask = UIViewAutoresizingFlexibleWidth; bField.autoresizingMask = carrierField.autoresizingMask; cField.autoresizingMask = UIViewAutoresizingFlexibleWidth; dField.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; eField.autoresizingMask = priceField.autoresizingMask; So when the bottom section of code doesn't exist, everything works as expected, but when it does, a lot of the labels start falling off the right side or being stretched to where their centers are far to the right. Am I overlooking something simple?

    Read the article

  • Time flies like an arrow demo in WinForms

    - by Benjol
    Looking at the Reactive Extensions for javascript demo on Jeff Van Gogh's blog, I thought I'd give it a try in C#/Winforms, but it doesn't seem to work so well. I just threw this into the constructor of a form (with the Rx framework installed and referenced): Observable.Context = SynchronizationContext.Current; var mousemove = Observable.FromEvent<MouseEventArgs>(this, "MouseMove"); var message = "Time flies like an arrow".ToCharArray(); for(int i = 0; i < message.Length; i++) { var l = new Label() { Text = message[i].ToString(), AutoSize = true, TextAlign = ContentAlignment.MiddleCenter }; int closure = i; mousemove .Delay(closure * 150) .Subscribe(e => { l.Left = e.EventArgs.X + closure * 15 + 10; l.Top = e.EventArgs.Y; //Debug.WriteLine(l.Text); }); Controls.Add(l); } When I move the mouse, the letters seem to get moved in a random order, and if I uncomment the Debug line, I see multiple events for the same letter... Any ideas? I've tried Throttle, but it doesn't seem to make any difference. Am I just asking too much of WinForms to move all those labels around? (Cross posted on Rx Forum)

    Read the article

  • Why unchecked jQuery UI radio button's label appears "checked" after refresh in FF and IE?

    - by Daj pan spokój
    I've got 2 radio buttons with labels: button A is checked by default in HTML (checked="checked"). They're then processed with jQuery UI Radio Button. When I check button B and refresh the page, B's label is displayed as checked (it has CSS ui-state-active class). And A's label is displayed as unchecked, even though it's A button that is actually checked. It happens in Firefox (3) and IE (8). In Chrome (5) it works fine - after refresh A's label is displayed as checked. <input class="ui-helper-hidden-accessible" id="show-all-hotels" name="radio" CHECKED="CHECKED" type="radio"> <label aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-left" aria-pressed="false" for="show-all-hotels"> <span class="ui-button-text">All tours</span> </label> <input class="ui-helper-hidden-accessible" id="show-availability" name="radio" type="radio"> <label aria-disabled="false" role="button" aria-pressed="true" class="UI-STATE-ACTIVE ui-button ui-widget ui-state-default ui-button-text-only ui-corner-right" for="show-availability"> <span class="ui-button-text">Only available at</span> </label> Do You know why is it happening and how to make checked button label appear as checked in all browsers?

    Read the article

  • Optimized graph drawing for the web

    - by Andreas Petersson
    Having seen some suggestions for graphs, I wonder what's the optimum for my problem. I want to render a directed graph to a servlet/picture that is displayed in the browser. There should be some kind of optimization of position. No dependency to Swing would be preferred. Algorithms are not important, since the structure of the graph is determined by business logic. It would be desired to be able add labels to edges as well. it would be optimal if i can serve this as png/svg. Which library/service would you recommend? clarifications: 1) The question is all about Graphs - like Directed Acyclic Graph - NOT - Charts. 2) flot, Google Charts - cannot plot graphs, only charts, or have i missed something? 3) no i do not need interactivity 4) graphviz would be nice, but the grappa java library is quite outdated and is built upon swing/awt. while it may be theoretically possible to render swing to images, it would not be my favorite way to to so in a server-app. 5) it would be fine to use an online service where the images are not hosted locally. edit: added links to Wikipedia to clarify graph/chart term

    Read the article

  • Wpf progressbar not updating during method calculation

    - by djerry
    Hey guys, In my app, i have an import option, to read info from a .csv or .txt file and write it to a database. To test, i"m just using 200-300 lines of data. At the beginning of the method, i calculate number of objects/lines to be read. Every time an object is written to the database, i want to update my progressbar. This is how i do it : private void Update(string path) { double lines = 0; using (StreamReader reader = new StreamReader(path)) while ((reader.ReadLine()) != null) lines++; if (lines != 0) { double progress = 0; string lijn; double value = 0; List<User> users = new List<User>(); using (StreamReader reader = new StreamReader(path)) while ((line = reader.ReadLine()) != null) { progress++; value = (progress / lines) * 100.0; updateProgressBar(value); try { User user = ProcessLine(lijn); } catch (ArgumentOutOfRangeException) { continue; } catch (Exception) { continue; } } return; } else { //non relevant code } } To update my progressbar, i'm checking if i can change the ui of the progressbar like this : delegate void updateProgressbarCallback(double value); private void updateProgressBar(double value) { if (pgbImportExport.Dispatcher.CheckAccess() == false) { updateProgressbarCallback uCallBack = new updateProgressbarCallback(updateProgressBar); pgbImportExport.Dispatcher.Invoke(uCallBack, value); } else { Console.WriteLine(value); pgbImportExport.Value = value; } } When i!m looking at the output, the values are calculated correctly, but the progressbar is only showing changes after the method has been called completely, so when the job is done. That's too late to show feedback to the user. Can anyone help me solve this. EDIT : I'm also trying to show some text in labels to tell te user what is being done, and those aren't udpated till after the method is complete. Thanks in advance.

    Read the article

  • how to define fill colours in ggplot histogram?

    - by Andreas
    I have the following simple data data <- structure(list(status = c(9, 5, 9, 10, 11, 10, 8, 6, 6, 7, 10, 10, 7, 11, 11, 7, NA, 9, 11, 9, 10, 8, 9, 10, 7, 11, 9, 10, 9, 9, 8, 9, 11, 9, 11, 7, 8, 6, 11, 10, 9, 11, 11, 10, 11, 10, 9, 11, 7, 8, 8, 9, 4, 11, 11, 8, 7, 7, 11, 11, 11, 6, 7, 11, 6, 10, 10, 9, 10, 10, 8, 8, 10, 4, 8, 5, 8, 7), statusgruppe = c(0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, NA, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0)), .Names = c("status", "statusgruppe"), class = "data.frame", row.names = c(NA, -78L )) from that I'd like to make a histogram: ggplot(data, aes(status))+ geom_histogram(aes(y=..density..), binwidth=1, colour = "black", fill="white")+ theme_bw()+ scale_x_continuous("Staus", breaks=c(min(data$status,na.rm=T), median(data$status, na.rm=T), max(data$status, na.rm=T)),labels=c("Low", "Middle", "High"))+ scale_y_continuous("Percent", formatter="percent") Now - i'd like for the bins to take colou according to value - e.g. bins with value 9 gets dark grey - everything else should be light grey. I have tried with "fill=statusgruppe", scale_fill_grey(breaks=9) etc. - but I can't get it to work. Any ideas?

    Read the article

  • Custom UITableViewCell with 2 UILabel's resized

    - by petert
    I'm struggling to create a custom UITableViewCell (in IB) that has a UIImageView on the left, fixed to the top left corner, then 2 UILabel's adjacent to it, side by side. So the cell looks something like: +---------------------------+ | IMAGE LABEL1 LABEL2 > | +---------------------------+ What I cannot seem to do is to change the frame of LABEL1 so it fits the text is contains, then make sure LABEL2 moves to the left (or right) so it ends up directly adjacent to it, filling all the space for the rest of the cell. So, concentrating on the label text, I'd like cell to look like this: +---------------------------+ | IMAGE Call 123456 > | +---------------------------+ after I've set LABEL1 to "Call" and LABEL2 to "123456" in: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath Actually I can resize LABEL1 with this: CGSize sizeToMakeLabel = [label.text sizeWithFont:label.font]; label.frame = CGRectMake(label.frame.origin.x, label.frame.origin.y, sizeToMakeLabel.width + 3, sizeToMakeLabel.height); Now the frame for the text "Call" fits this text (confirmed by setting a background color), but the text "123456" doesn't seem to shift to the left, whatever autosizing I set in IB, or methods to resize the cells view? I seem to need the +3 to make sure "Call" didn't look like this "C…" also? I'm using 2 labels so LABEL1 can be in a bold font say.

    Read the article

  • Changing UITableViewCell textLabel background color to clear

    - by SorinA.
    In my app i have a table view with customViewCells. i subclassed the UITableViewCell class and added an image that will load async and for the text i use cell.textLabel.text = @"someThext". for the cells the background color is set alternatively to [UIColor darkGrayColor] and whitecolor. When i run the app in the simulator and on the pone the textLabel of the cell has the background white. I want to set it to be clear, because i want the background color of the cell to be full not a strip then white then another strip. in the init method of my custom cell i added hoping that the white will turn into red but it doesn't have any effect. [self.textLabel setBackgroundColor:[UIColor redColor]]; i tried also self.textLabel.backgroundColor = [UIColor redColor]; but this also didn't work...if i add a UILabel as a subview the background color of the label can be set..but i don't want to do that because when i rotate the phone i want my labels to auto enlarge... any ideas why setting the background color of cell.textLabel doesn't work? thank you

    Read the article

  • Problem with asp.net function syntax (not returning values correctly)

    - by Phil
    I have an active directory search function: Function GetAdInfo(ByVal ADDN As String, ByVal ADCommonName As String, ByVal ADGivenName As String, ByVal ADStaffNum As String, ByVal ADEmail As String, ByVal ADDescription As String, ByVal ADTelephone As String, ByVal ADOffice As String, ByVal ADEmployeeID As String) As String Dim netBIOSname As String = Me.Request.LogonUserIdentity.Name Dim sAMAccountName As String = netBIOSname.Substring(netBIOSname.LastIndexOf("\"c) + 1) Dim defaultNamingContext As String Using rootDSE As DirectoryServices.DirectoryEntry = New DirectoryServices.DirectoryEntry("LDAP://RootDSE") defaultNamingContext = rootDSE.Properties("defaultNamingContext").Value.ToString() End Using Using searchRoot As DirectoryServices.DirectoryEntry = _ New DirectoryServices.DirectoryEntry("LDAP://" + defaultNamingContext, _ "kingkong", "kingkong", DirectoryServices.AuthenticationTypes.Secure) Using ds As DirectoryServices.DirectorySearcher = New DirectoryServices.DirectorySearcher(searchRoot) ds.Filter = String.Format("(&(objectClass=user)(objectCategory=person)(sAMAccountName={0}))", sAMAccountName) Dim sr As DirectoryServices.SearchResult = ds.FindOne() 'If sr.Properties("displayName").Count = 0 Then whatever = string.empty '' (how to check nulls when required) ' End If ADDN = (sr.Properties("displayName")(0).ToString()) ADCommonName = (sr.Properties("cn")(0).ToString()) ADGivenName = (sr.Properties("givenname")(0).ToString()) ADStaffNum = (sr.Properties("sn")(0).ToString()) ADEmail = (sr.Properties("mail")(0).ToString()) ADDescription = (sr.Properties("description")(0).ToString()) ADTelephone = (sr.Properties("telephonenumber")(0).ToString()) ADOffice = (sr.Properties("physicalDeliveryOfficeName")(0).ToString()) ' ADEmployeeID = (sr.Properties("employeeID")(0).ToString()) End Using End Using Return ADDN Return ADCommonName Return ADGivenName Return ADStaffNum Return ADEmail Return ADDescription Return ADTelephone Return ADOffice ' Return ADEmployeeID 'have commented out employee id as i dont have one so it is throwing null errors. ' im not ready to put labels on the frontend or catch this info yet End Function The function appears to work, as when I put a breakpoint at the end, the variables such as ADDN do have the correct values. Then I call the function in my page_load like this: GetAdInfo(ADDN, ADCommonName, ADGivenName, ADStaffnum, ADEmail, ADDescription, ADTelephone, ADOffice, ADEmployeeID) Then I try to response.write out one of the vars to test like this: Response.Write(ADDN) But the value is empty. Please can someone tell me what I am doing wrong. Thanks

    Read the article

  • How to keep text inside a circle using Cairo?

    - by miguelrios
    I a drawing a graph using Cairo (pycairo specifically) and I need to know how can I draw text inside a circle without overlapping it, by keeping it inside the bounds of the circle. I have this simple code snippet that draws a letter "a" inside the circle: ''' Created on May 8, 2010 @author: mrios ''' import cairo, math WIDTH, HEIGHT = 1000, 1000 #surface = cairo.PDFSurface ("/Users/mrios/Desktop/exampleplaces.pdf", WIDTH, HEIGHT) surface = cairo.ImageSurface (cairo.FORMAT_ARGB32, WIDTH, HEIGHT) ctx = cairo.Context (surface) ctx.scale (WIDTH/1.0, HEIGHT/1.0) # Normalizing the canvas ctx.rectangle(0, 0, 1, 1) # Rectangle(x0, y0, x1, y1) ctx.set_source_rgb(255,255,255) ctx.fill() ctx.arc(0.5, 0.5, .4, 0, 2*math.pi) ctx.set_source_rgb(0,0,0) ctx.set_line_width(0.03) ctx.stroke() ctx.arc(0.5, 0.5, .4, 0, 2*math.pi) ctx.set_source_rgb(0,0,0) ctx.set_line_width(0.01) ctx.set_source_rgb(255,0,255) ctx.fill() ctx.set_source_rgb(0,0,0) ctx.select_font_face("Georgia", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_BOLD) ctx.set_font_size(1.0) x_bearing, y_bearing, width, height = ctx.text_extents("a")[:4] print ctx.text_extents("a")[:4] ctx.move_to(0.5 - width / 2 - x_bearing, 0.5 - height / 2 - y_bearing) ctx.show_text("a") surface.write_to_png ("/Users/mrios/Desktop/node.png") # Output to PNG The problem is that my labels have variable amount of characters (with a limit of 20) and I need to set the size of the font dynamically. It must fit inside the circle, no matter the size of the circle nor the size of the label. Also, every label has one line of text, no spaces, no line breaks. Any suggestion?

    Read the article

  • Right-Align and Vertical Align label with checkbox/radio button CSS

    - by Jon
    Hi Everyone, I'm very close and have this working in Safari, Firefox and IE8, however IE7 the labels and radio buttons do not align vertically. My HTML is: <div id="master-container"> <fieldset id="test"> <legend>This is a test of my CSS</legend> <ul class="inputlist"> <li> <label for="test1">Test 1</label> <input name="test1" id="test1" type="checkbox" disabled="disabled"/> </li> <li> <label for="test2">Test 2</label> <input name="test2" id="test2" type="checkbox" disabled="disabled"/> </li> </ul> </fieldset> </div> My CSS Is: html{font-family:Arial,Helvetica,sans-serif;} #master-container{width:615px;font-size:12px;} ul.inputlist{list-style-type:none;} ul.inputlist li{width:100%;margin-bottom:5px;} ul.inputlist li label{width:30px; text-align:right; margin-right:7px;float:left;} Any suggestions? Thanks! EDIT: Based on the suggestion to check the rest of my html and css. I updated the code above and now it accurately demonstrates the problem. If I take font-size out of #master-container it lines up but then it is not the proper font-size. I tried to add a font-size to ul.inputlist li input but that didn't help. Any suggestions? Thanks for your help everyone!

    Read the article

  • Incorrect rendering in dojox charting stacked column?

    - by FokeyJoe
    Hiya, I seem to be having a problem with my dojo stackedcolumn whereby the scale of some of the bars is correct for some x-axis points, but not others. Here's my code (observe the northern ireland hydro should be 70, but only shows as around 30): dojo.addOnLoad(function() { var chart1 = new dojox.charting.Chart2D("sitesbycountry"); chart1.addPlot("default", {type: "StackedColumns", gap: 10}); chart1.addPlot("horzgrid", {type: "Grid", hMajorLines: true, vMajorLines: false}); chart1.addAxis("x", {labels: [{value: 1, text: 'Northern Ireland'}, {value: 2, text: 'Wales'}, {value: 3, text: 'Scotland'}, {value: 4, text: 'England'}], minorTicks: false, microTicks: false}); chart1.addAxis("y", {vertical: true, minorTicks: false, microTicks: false}); chart1.addSeries("Hydro", [70, 53, 198, 102], {fill: "#ddddff"}); chart1.addSeries("Wind and Wave", [67, 51, 150, 245], {fill: "#FEFFBF"}); chart1.addSeries("Landfill", [1, 23, 40, 0], {fill: "#CFFFD1"}); chart1.addSeries("Other Biofuels and Wastes", [4, 3, 11, 66], {fill: "#DFD2C3"}); chart1.render(); }); Is this a behaviour of the chart that I'm not aware of? TIA FokeyJoe

    Read the article

  • CSS Rotation & IE: absolute positioning seems to break IE

    - by user263900
    I'm trying to rotate a variety of text blocks so they are vertically oriented, and position them in very specific locations on a diagram which will be previewed and then printed. CSS rotates the text very nicely in IE, FF, even Opera. But when I try to position a rotated element, IE 7 & 8 (not worried about 6) breaks completely and the element stays in its original location. Any way around this? I really need to-the-pixel control of where these labels are located. HTML <div class="content rotate"> <div id="Div1" class="txtblock">Ardvark Avacado<br />Awkward</div> <div id="Div2" class="txtblock">Brownies<br />Bacteria Brussel Sprouts</div> </div> CSS div.content { position: relative; width: 300px; height: 300px; margin: 30px; border-top: black 4px solid; border-right: blue 4px solid; border-bottom: black 4px dashed; border-left: blue 4px dashed; } .rotate { -webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); -o-transform: rotate(-90deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); } .txtblock { width: auto; position: absolute; } #Div1 { left:44px; top:70px; border:red 3px solid; } #Div2 { left:13px; top:170px; border:purple 3px solid; }

    Read the article

  • ASP.NET MVC DisplayAttribute and interfaces

    - by msi
    I have some interface and classes public inteface IRole { int Id { get; } string Name { get; set; } } public class Role : IRole { public int Id { get; } [Display("Role Name")] public string Name { get; set; } } public class Member { [Display("Login")] public string Login { get; set; } [Display("Password")] public string Password { get; set; } public IRole Role { get; set; } } on View I try to use, View is strongly type of Member on this line displays correct message from DisplayAttribute <%= Html.LabelFor(m => m.Login) %> on this line it does not display correct label from DisplayAttribute <%= Html.LabelFor(m => m.Role.Name) %> How can I fix this to have correct labels in such architecture? Thanks P.S. I know about adding DisplayAttribute to the interface field and all will work, but maybe there are different solution.

    Read the article

  • UIScrollView only works if the child views aren't hit

    - by dny238
    I have a scroll view that doesn't scroll right, I've simplified the code for below. It draws the view and some horizontal buttons that i add more stuff to in the real code. If you drag the whitespace between the buttons the view scrolls. If you happen to put your finger on a button, it won't scroll. After a related suggestion, I tried to add the delaysContentTouches = YES line, but it doesn't seem to make a difference. http://stackoverflow.com/questions/650437/iphone-uiscrollview-with-uibuttons-how-to-recreate-springboard What am I doing wrong? TIA, Rob Updated the code - (void)viewDidLoad { l = [self landscapeView]; [self.view addSubview:l]; [l release]; } - (UIScrollView *) landscapeView { // LANDSCAPE VIEW UIScrollView *landscapeView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 325)]; landscapeView.backgroundColor = [UIColor whiteColor]; landscapeView.delaysContentTouches = YES; NSInteger iMargin, runningY, n; iMargin = 3; runningY = iMargin; for (n = 1; n <= 38; n++) { //add day labels UIButton *templabel = [[UIButton alloc] initWithFrame:CGRectMake(iMargin,runningY,320 - ( 2 * iMargin),20)]; templabel.backgroundColor = [UIColor grayColor]; [landscapeView addSubview:templabel]; [templabel release]; runningY = runningY + 30; } landscapeView.contentSize = CGSizeMake( 320, runningY); return landscapeView; }

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >