Free Download

Site Search

 

Top Download

Showing posts with label free source. Show all posts
Showing posts with label free source. Show all posts

Friday, July 4, 2008

Edit MS Flex Grid in Two Ways

Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

Hi all!

This is my second article on Code Project. This is about how to edit MS Flex Grid. I was using TextBox and ComboBox to edit flex grid at run time, for that I had to add reference of Microsoft.VisualBasic.Compatibility and some complex coding to move TextBox or ComboBox on grid. But this is good idea if some one wants to edit grid with some predefined itemsusing ComboBox.

But if you want to text than there is a simple way to do this; that is the use of Text property of MS Flex Grid Control.

Using the code

To edit MS Flex Grid without using TextBox we have to use .Text property and KeyPressEvent of MS Flex Grid Control.

 
Private Sub AxMSFlexGrid1_KeyPressEvent(ByVal sender As Object, ByVal e As AxMSFlexGridLib.DMSFlexGridEvents_KeyPressEvent) Handles AxMSFlexGrid1.KeyPressEvent

Select Case e.keyAscii

Case 30 To 136

AxMSFlexGrid1.Text += Chr(e.keyAscii)

Case 8

If AxMSFlexGrid1.Text <> "" Then AxMSFlexGrid1.Text = Mid(AxMSFlexGrid1.Text, 1, Len(AxMSFlexGrid1.Text) - 1)

Case 13 And AxMSFlexGrid1.Col <> 2

AxMSFlexGrid1.Col = 2

Case 13 And AxMSFlexGrid1.Col = 2

AxMSFlexGrid1.Rows = AxMSFlexGrid1.Rows + 1

AxMSFlexGrid1.Col = 1

AxMSFlexGrid1.Row = AxMSFlexGrid1.Row + 1

End Select

End Sub

In second techinque I have used a function name moveTextBox to move TextBox at appropriate posiotion and to sent enter text in Grid I have used .Textproperty of Grid control.

 
Private Sub moveTextBox()
TxtEntry.Visible = True
TxtEntry.Left = VB6.TwipsToPixelsX(AxMSFlexGrid2.CellLeft + VB6.TwipsToPixelsX(AxMSFlexGrid2.Left)) + 17
TxtEntry.Top = VB6.TwipsToPixelsY(AxMSFlexGrid2.CellTop + VB6.TwipsToPixelsY(AxMSFlexGrid2.Top)) + AxMSFlexGrid2.Top
TxtEntry.Width = VB6.TwipsToPixelsX(AxMSFlexGrid2.CellWidth)
TxtEntry.Height = VB6.TwipsToPixelsY(AxMSFlexGrid2.CellHeight)
TxtEntry.BringToFront()
TxtEntry.Focus()
End Sub

On TextBox's KeyDown event I have assigned TextBox's .Text property to Flex Grid's .Text property

 
Private Sub TxtEntry_KeyDownEvent(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TxtEntry.KeyDown
If AxMSFlexGrid2.Col = 1 Then
If e.KeyCode = Keys.Enter Then
AxMSFlexGrid2.Text = TxtEntry.Text
TxtEntry.Clear()
AxMSFlexGrid2.Col = 2
End If
End If
End Sub

On EnterCell event of Grid Control I have called this function.


Private Sub AxMSFlexGrid2_EnterCell(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxMSFlexGrid2.EnterCell
If AxMSFlexGrid2.Col = 2 Then
Call moveCombo()
If AxMSFlexGrid2.get_TextMatrix(AxMSFlexGrid2.Row, 2) <> "" Then
CmbEntry.Text = AxMSFlexGrid2.get_TextMatrix(AxMSFlexGrid2.Row, 2).ToString
Else
CmbEntry.Text = ""
End If
Else
CmbEntry.Visible = False
End If
If AxMSFlexGrid2.Col = 1 Then
Call moveTextBox()
If AxMSFlexGrid2.get_TextMatrix(AxMSFlexGrid2.Row, 1) <> "" Then
TxtEntry.Text = AxMSFlexGrid2.get_TextMatrix(AxMSFlexGrid2.Row, 1).ToString
Else
TxtEntry.Clear()
End If
Else
TxtEntry.Visible = False
End If
End Sub

Thanx And Happy Coding..

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

suresh suthar


Hi All.
I am Suresh Suthar from Mumbai India.
I am a Software Developer working in a private firm as a .NET developer.
I born and brought up in a small village Sewari in Rajasthan.
I started my carrier as a data entry operator in 2006. After that I started learning VB 6.0 and VB.NET 2005.
Now I am developing software using VB.Net 2005
and SQL Server 2000/2005.

Here you will some cool source code and a lots of stuff on
SQL Injection, Code Injection, Encription/Decription, Live project, Tutorials on VBScript,JavaScript,Cold Fusion, C#
and many more...

http://www.programmer2programmer.net/
Occupation: Web Developer
Location: India India


http://www.codeproject.com/KB/grid/EditMSFlexGrid.aspx

Wednesday, October 10, 2007

What is jsProgressBarHandler ?

jsProgressBarHandler is a rewrite of the (unfortunately wrongly named) AJAX Progress / Percentage Bar by Webappers. Improvements made were the change from a set of functions to a true Prototype.js Class, reduction in the number of functions, and making it unobtrusive (if javascript is disabled you'll still see the percentage), amongst some minor tweaks.
jsProgressBarHandler has been tested and verified working in IE6, IE7, FireFox 2 and Safari 3.0.3. Other browsers should work fine too (untested though).

Friday, October 5, 2007

Fleegix.js: Simple. Useful. JavaScript.



Fleegix.js provides an extremely lightweight, cross-browser set of JavaScript tools for building dynamic Web-app UIs.
Fleegix.js includes the basics of what you need to build an Ajaxy Web app:
A concise but powerful
events system
An industrial-strength
XHR library
JSON and Web form serialization
CSS manipulation
Visual effects
To keep the toolkit small, more specialized features are broken off into
optional plugins, including:
JavaScript Dates with Olson timezone support
a simple, no-muss-no-fuss
XML parser
a sortable
Hash
useful date utilities such as strftime, add, and diff
Some
color conversion utilities
Most of the plugins can be used standalone with your JS toolkit of choice.
Fleegix.js does not attempt to coerce JavaScript into behaving like Python, Ruby, Java, or any other language -- the code is plain, ordinary, idiomatic JavaScript. Simple, but potent stuff.
It is well tested in the major-market-share browsers -- Firefox 1+, Internet Explorer 6+, and Safari 2.
Fleegix.js is licensed under the
Apache License, Version 2.

ModalPopup with Multiple Cancel Buttons



I recently stumbled across the following post. In the entry, the author describes a simple modal popup he has created for his hotel reservation ASP.NET AJAX web application. While developing the popup control, he ran into a problem when trying to include both a 'Close' button at the bottom of the dialog as well as a close 'X' button in the top right corner:
I ran into a bit of a stumbling block because I wanted to have multiple buttons close the popup. I had the OK button and the cancel button centered and vertically aligned at the bottom of the window, but I also wanted a cancel button in the top right (ie "Cancel [X]") - with the familiar [X] that we know and love for closing something. The problem is, I couldn't figure out how to assign more than one control to the CancelControlID.
Live Demo Download
[Update 10/3/2007]: As Koen points out, the sample modal dialog doesn't look as nice in IE6 (it looks fine in FF and IE7)
Thankfully Dave found a solution that he found to be workable. He wrapped the
MoalPopupExtender in an UpdatePanel and explicitly called the Hide method from the server side button event handler. It sounds like this approach has worked him, but I thought I would provide a quick example of how you can dismiss the dialog without roundtripping to the web server.
To close the popup without having to leave the client, all you have to do is call the hide function of the
ModalPopup's client-side JavaScript behavior. Here is a quick example of the easiest way to accomplish this. Below is the markup for a modal popup that contains a message, an OK button and 6 Cancel buttons. Notice the two area's outlined in red. In the first outlined area I assigned the BehaviorID attribute of the ModalPopupExtender to a unique id ('mdlPopup' in this example). Then, in the OnClientClick of each of my Cancel buttons I pass this BehaviorID to the ASP.NET AJAX $find JavaScript shortcut function. The $find function will fetch the JavaScript behavior for the modal popup. Once I have a reference to the popup's behavior I invoke the hide function - which will hide my dialog.

jQuery Treetable



Take a plain html table, wrap the rows you want collapsing/expanding in a tbody with an id of treetable, map each row to it's parent row, set some options, and let jQTreeTable take it from there.
By wrapping it in a tbody, it means you can have other rows within the same table not part of the tree, and it also means that if javascript is disabled, users still get the plain table.
You can set which column takes the treeview effect, and you can also set which parents are collapsed initially. To do this, it must be done with an array, even if there is only one node you want collapsed.
A highlight option can be set so that rows change colour as they are hovered over. There is dynamic striping of the rows, and there is also a custom onselect event which fires on the table cells, that can be handled with a callback function (watch the status bar when you click on a cell). Links within the cells still work as expected.
I took the graphics files from J๖rn Zaefferer's site, and adapted them for my purposes. I hope he doesn't mind.
Sorry I've nowhere to put comments as yet, but I will be keeping a close eye on the jquery-en list, so any feedback/bug finds would be appreciated.
By the way, if you use the script off this page, make sure to remove the part of the script written for this page (just one line). Alternatively, you can download the zipped file here. It includes this php page with it's random treetable generator.

var options = {openImg: "tv-collapsable.gif", shutImg: "tv-expandable.gif", leafImg: "tv-item.gif", lastOpenImg: "tv-collapsable-last.gif", lastShutImg: "tv-expandable-last.gif", lastLeafImg: "tv-item-last.gif", vertLineImg: "vertline.gif", blankImg: "blank.gif", collapse: false, column: 1, striped: true, highlight: true, onselect: function(target){window.status = "You clicked "+target.html();}};
Map Array for the table below is :
[0, 0, 0, 0, 0, 5, 0, 0, 8, 9, 8, 8, 0, 0, 14, 14, 14, 0, 18, 0, 0, 21, 22, 22, 22, 0, 0, 27, 27, 27, 30, 31, 31, 0, 0, 0, 0, 37, 37, 0, 0, 41, 41, 41, 44, 41, 46, 41, 41, 41]


Sample : http://www.hanpau.com/jquery/unobtrusivetreetable.php

Monday, September 17, 2007

Javascript image rollover



JavaScript image rollovers
JavaScript image rollovers have been one of the most used features for bringing interactivity to web pages. They refer to the change in the image when the mouse cursor is moved over and subsequently off the image.


Rollovers employ two JavaScript event handlers. onmouseover, that captures the action when the mouse cursor is brought over an image and onmouseout, that detects the action when the mouse cursor is moved off an image. These two even handlers are placed inside the anchor tag that surrounds the IMG tag.

We also use the src property of the JavaScript image object. This property refers to the file name of the image being displayed (image source). Finally, we employ the NAME attribute of the HTML IMG tag to explicitly refer to the image in question.
The logic is extremely simple. It's a matter of changing the image when the mouse cursor is placed over it and then changing it back to the original when the mouse cursor moves off the image.
Let's construct our image tag:



<img height="39" alt="Move your mouse over me" src="http://www.blogger.com/moveup.gif" width="143" border="0" name="sub_but" />

Note: We use the NAME attribute of the HTML IMG tag to give the name sub_but to our image. JavaScript event handlers will refer to the image with this name.You'll notice that the image source (file name) is moveup.gif, which is the image to be displayed when the mouse cursor is off the image.
Now, we place anchor tags around this image:


<a href="http://www.blogger.com/somewhere.html">
<img height="39" alt="Move your mouse over me" src="http://www.blogger.com/moveup.gif" width="143" border="0" name="sub_but" />
</a>


Lastly, we include the two JavaScript event handlers inside this anchor tag.

<a onmouseover="document.sub_but.src='movedown.gif'" onmouseout="document.sub_but.src='moveup.gif'" href="http://www.blogger.com/somewhere.html">
<img height="39" alt="Move your mouse over me" src="http://www.blogger.com/moveup.gif" width="143" border="0" name="sub_but" />
</a>