In Gtk, how do I remove the shadow from a Statusbar? - c#

If I make a Statusbar, and PackEnd a Label to it, it looks something like this:
The Shadow disappears over the Label, but remains over the rest of the Statusbar. I want to remove the Shadow from the entire Statusbar. The PyGTK documentation mentions a property called shadow-type, but it's readonly, and nowhere to be found in GTK#. How do I get rid of this shadow?

You're not supposed to pack stuff into the statusbar, it's not meant as a general container.
To display text in a status bar, use its own API, i.e. gtk_statusbar_push() from C. The GTK# docs on go-mono.com seem to be offline, so I couldn't link to those right now.

shadow-type is a style property, which means it's actually supposed to be set by the user and/or desktop theme. You can set it by writing a custom style file for your application and reading it in using gtk.RcStyle.
If you have a need for two separate status messages in your application, you could also consider packing two status bars into an hbox.

The first child of a GtkStatusbar is a GtkFrame which gives the shadow border (edit: apparently not). You should be able to do this:
statusbar.get_children()[0].set_shadow_type(gtk.SHADOW_NONE)
Several apps (most notably Epiphany and, in the past, Galeon) actually replace the contents of that frame with an HBox so they can add stuff to the statusbar.

Related

Workaround for screen flicker

Writing a fairly simple app with c#/wpf.
When opening a second window there is a brief flicker or flash.
Extensive googling says that this caused by screen repainting, so not much I can do about that.
(I haven't included any code because it seems this problem is well known and something most people 'learn to live with')
So, I thought, why not put all the XAML in one file with each page within its own grid that I can hide/show with visibility.visible or visibility.collapsed etc.
Works nicely (apart from a very slight delay - less than 1/2 second - the first time i show the second window grid), but I'm unhappy at the idea of containing all the code behind in a single page. (for what its worth, i'm told that compiler see's it all as one file anyway but ... )
Is there a way I can create separate 'code behind files for each 'windows' (in reality a XAML Grid) functionality whilst linking them all to the same Xaml File?
(I have a horrible feeling having typed this that the answer is obvious and I should already know it ...)
Thanx
If I understand you correctly, you just need to create a new Control Class-Code Behind pair for each 'window grid'. This is done in VS by clicking Add-Create Element-User Control (of name UserControl1.xaml, rename it to something Like YourControl.xaml) in Solution Explorer (I think you already know all this, but just in case).
Now, if there is no specific requirement for the control to be of type Grid, you can use it as it is:
<MainWindow>
<Grid>
<YourControlNumberOne />
<YourControlNumberTwo />
<YourControlNumberThree />
<Grid/>
</MainWindow>
If you specifically need Grid-based control, just change the base class of YourControl to Grid, and change the topmost XAML element in the associated XAML file to Grid.

A C# list of custom childs similar with android ListView

I need to create a list in c# with click-able and customizable child elements.
Check attached image (red square) to get a feeling of what I would like to end up with. I tested on a control called "list view". I can add an icon and a label, it is not enough, I need more customization.
So question: Which c# control should I use? Maybe share a link if you know something useful.
Note: I don't really know or enjoy C# (I am Java guy), as IDE I use Visual Studio C#, express edition and I would love to minimize the coding part as much as possible
First, create a user control (says ContactRow.cs)
Draw what ever UI that you need on it. (Image, text, etc)
Secondly, Create a container form (says ContactList.cs)
Add a TableLayoutPanel (Or FlowLayoutPanel Or equivalent) into container form.
Set AutoScroll property = true so that it scrolls.
In run time, you can new an instance of your ContactRow.cs and set all the values.
Then add it into the TableLayoutPanel using the TableLayoutPanel.Controls.Add(contactrow)

Custom MessageBox in C#

I am making a custom MessageBox in my own language (Persian). I want to know which component may I use for the text?
Label is not multiline and TextBox is a little bit not appropriate.
Which component does Visual Studio use itself?
What is the component I specified in the picture?
You can use a label. It has a number of options for laying out the text... One way is to set it to "AutoSize = True".
I support the answer of RQDQ, labels could be enlarged to occupy more than one line.
They have a property named TextAlign. When set to LeftCenter or MiddleCenter you could simulate the behavior of text in a message box. If the text doesn't fit in a single line, the label wraps it automatically on another line. However in this case I will let the property AutoSize to its false default value.
It all depends on what kind of Visual Studio project you are doing. Wpf or Silverlight or Asp.net or even windows, everything will depend upon which kind of project it is.
That looks to me like the MFC style label with an image, or in a browser it would be done with javascript.
You Can Use RichTextBox. I Use it For My Custom MessageBox And it works Correctlly

dynamic window focus MVC2

I am working on an MVC2 project, on a view we display a large data set which refreshes every minute with latest data..some specific records are updated every minute in this data set. I want the browser to focus on these specific records..Not sure how to use javascript focus() here dynamically...
any clue?
thanks,
You need to provide more detail as to exactly what you are attempting to do.
If you are attempting to focus just ensure each record has a unique identifier then you can focus on individual records.
Alternatively you could simply keep the focus at the top or bottom of wherever you are displaying them.
EDIT:
In that case I would suggest something like the following
var currEle = document.getElementById("Record123");
currEle.focus();
Suppose you know how to issue an Ajax call and return either partial view or JSON data and how to use that data on the client afterwards...
You can only focus to a point in the document when
there's only one change or
all changes are summarised together in the same document area
We're also not talking about focusing as in document perspective, but rather about focusing of users attention to document specific content (or part of it).
First option
You can always use something like jQuery.scrollintoview() plugin (link to blog post that describes the plugin here) that will scroll document to the record that changed and highlight it using jQuery UI effect highlight. Linked blog post also describes the purpose of visual animated scrolling instead of simple jumping within the document.
Second option
Put changes at the top and keep your document scrolled at the top when content gets updated. You can blink a few times some icon informing the user of the changed content in the changes area.

C# PrintDocument Changed event

My issue is that I've created an "extended" RichTextBox control that uses native API to add many RichEdit features that are missing from the standard control (ie: modifying a single font property on a selection w/o changing the other font properties, word wrap to a printer [like WordPad], etc.). As part of the control I expose a PrintDocument that is used to print the formatted contents of the RichTextBox. When wordwrap is set to "Wrap To Printer" I SendMessage the EM_SETTARGETDEVICE message to the RichTextBox and cause it to wrap to the appropriate length.
This all works fine when something (user/code) changes the WordWrap property of my control. However if the PrintDocument is modified after that I have no way of knowing it. So even though the user may have changed the margins on the PrintDocument my RichTextBoxEx doesn't resend the EM_SETTARGETDEVICE for the new width until the WordWrap property is changed.
I see a few options to overcome this but I'm not a big fan of any of them. Here's what I have:
Add a UpdatePrintDocument() method or similiar that would need to be called after something external from the control (ie: a PageSetupDialog on the parent form) updated the settings in the PrintDocument. Cons: I'll be distributing the control so I'd like to make it as friendly as possible. While I may remember to call the method anytime I successfully update the PrintDocument settings someone else might not. Pro: It's simple to implement.
Create a new, PrintDocumentEx class that bases from PrintDocument and implements the needed "Changed" events. Cons: Might not be enough, might need to create PrintSettingsEx, PageSettingsEx, etc.. Pro: Implement once and no one has to worry about it again.
I really think #2 is the option I'm going to have to go with but it's not very reusable for the next instance I need some similiar functionality. I guess what I'm looking for is a way to attach a "generic PropertyChanged event" to any existing classes property since this would be applicable in future situations. Anxious to see what you guys have for me :-)
If I have understood your question correctly, the information that you require is sent when the WordWrap property is changed.
When other things are changed, no events updates the Print Document. The next time the WordWrap property is changed all information is sent.
The hack way to fix this is then to change the WordWrap property, whenever you change a property that you want to send to the Print Document. Change it to a temporary value, then change it back again.
Just following up that my PrintDocumentEx (and associated) classed didn't work. Looking into the PrintDialog and related controls it's because they use native methods to acctually update the PrintDocument. So the events I attached to the properties in my "Ex" classes never fired because the set accessor was never invoked.

Categories