|
|
|||||||
KiXforms.Net Learning Series - Windows Registry Run [Project 01 - Lesson 01] Next Lessons: Project 01 - Lesson 02 Project 01 - Lesson 03 Guidelines:
KiXforms.Net Version Checker: Code: ;KiXforms.Net Version Checker ;Set Break to On if not in Logon Mode. If Not @LogonMode Break On EndIf ;Set Code Options to On Dim $SO $SO=SetOption("NoMacrosInStrings", "ON") $SO=SetOption("NoVarsInStrings", "ON") $SO=SetOption("Explicit", "ON") ;Setup Variables. Dim $System,$nul,$MainForm,$ProductVersionLabel,$ProductNameLabel ;Create 'Kixforms.System' Object. $System = CreateObject("Kixforms.System") ;Verify the 'Kixforms.System' Object was created if not, notify and exit. If Not $System $nul= MessageBox("KiXforms.Net Not Initiated."+@CRLF+ "Please verify KiXforms.Net is installed."+@CRLF+ "This Script Will Now Close.","Error",16) Quit() EndIf ;Create Form and Controls. $MainForm = $System.Form() $MainForm.StartPosition = $System.FormStartPosition_CenterScreen $MainForm.Size = $System.Size(338,83) $MainForm.Text = "KiXforms.Net Version Checker" $ProductVersionLabel = $System.Label() $ProductVersionLabel.Dock = $System.DockStyle_Top $ProductVersionLabel.Text = "Ver. "+$System.ProductVersion $ProductVersionLabel.TextAlign = $System.ContentAlignment_MiddleCenter $nul = $MainForm.Controls.Add($ProductVersionLabel) $ProductNameLabel = $System.Label() $ProductNameLabel.Dock = $System.DockStyle_Top $ProductNameLabel.Text = $System.ProductName $ProductNameLabel.TextAlign = $System.ContentAlignment_MiddleCenter $nul = $MainForm.Controls.Add($ProductNameLabel) ;Show the Form $MainForm.Show ;Loop to catch form events. While $MainForm.Visible $nul = Execute($MainForm.DoEvents()) Loop Exit 0 Objectives for Lesson 01:
Standard Code Set Options: Code: ;region Set Code Options ;Set Break to On if not in Logon Mode. If Not @LogonMode Break On EndIf ;Set Code Options to On Dim $SO $SO=SetOption("NoMacrosInStrings", "ON") $SO=SetOption("NoVarsInStrings", "ON") $SO=SetOption("Explicit", "ON") ;endregion Set Code Options Create:
The Form Appearance: |
||||||||
|
|
|||||||
You may use the image strip that I use for the 'ImageList' or create your own: |
||||||||
|
|
|||||||
You may use the image that I used for the icon for the 'Form.Icon' or create your own: |
||||||||
|
|
|||||||
The only Events and Functions you should work on/create is for:
I will post when solutions may be posted. You may begin.. |
||||||||
|
|
|||||||
My apologies you should also include functions for:
|
||||||||
|
|
|||||||
If you are participating please post that you are. |
||||||||
|
|
|||||||
As soon as I get some time freed up I want to participate. |
||||||||
|
|
|||||||
Me too. |
||||||||
|
|
|||||||
I'll try to get some time for it too... need to start with the.net stuff anyway |
||||||||
|
|
|||||||
Just saw this. I will work on it tomorrow. |
||||||||
|
|
|||||||
What does everyone think; Should we wait until next week before we reveal code? |
||||||||
|
|
|||||||
Yes please. I looked at it, and that is as far as I was able to get with mine. Having to implement things that I have never done before so... A bit of a learning curve |
||||||||
|
|
|||||||
Like I already said in a PM time just does not allow me to take part in this but I'm following the thread. I’d like to see code but next week is fine. |
||||||||
|
|
|||||||
Really sorry Benny. I know it takes a lot of time and effort to do this. I've just been quite busy as well and have not done work on it. Next week some time would be better I think. |
||||||||
|
|
|||||||
Yes, thanks for waiting Benny69. |
||||||||
|
|
|||||||
Yay, I say wait until END of next week! I have started, but my time's short these days and still I fiddle with WindowState property in coexistence with StartPosition ... there must've been some changes do kf.classic, eh ? |
||||||||
|
|
|||||||
Hey, I saw you on the daemon tools forum (http://www.daemon-tools.cc/dtcc/archive/t-445.html) And was wondering if you knew a Kix way of changing the drive letter of daemon tools. |
||||||||
|
|
|||||||
Well I am ready to admit that I am already having problems, and this is just form creation... Thanks Benny, you are making me actually do some reading... |
||||||||
|
|
|||||||
As I see it, this is a learning session, I don't see any reason that we can not ask questions, more than likely it will help others. As long as we don't post code until reveal time, if you have a question I am sure I can point you to the answers you need. |
||||||||
|
|
|||||||
Well my issue seems to be with utilizing the splitter. I have tried by creating panel that contains the top list view -docked top / left / bottom (tried all three)- add a splitter and match the dock as the first list view, and then add the second list fill with a dock of fill. The splitter nevers ends up in the correct place nor does it work on anything. I tried it without the panel, but had the same results. Then tried with each list view in it's own panel and the splitter in one or the other panels. As you can tell I have never worked with splitters before, and I am lost as how to implement it. |
||||||||
|
|
|||||||
When it comes to the '.Dock' property, the sequence that the controls are created in decides the position of the controls on the form. To understand what I am trying to say, using KFD.Net create two Panels on a blank form, then create a splitter on the form. Set the splitter.dock = bottom, set one panel.dock = bottom, and the other panel.dock = fill. In the object treeview (top right corner of KFD) select one of the controls (left click on the name of the control in the object treeview) then click the up or down arrow button (to the left of the object treeview). As you rearrange the control sequence in the object treeview the controls on the form will rearrange as well as the sequence that the controls are created on the code page (use the code/form button {top left corner of KFD} to switch from the form to the code and back). |
||||||||
|
|
|||||||
I'm in the middle of a company reinstall, all servers had to be reinstalled and we're working on perfectioning the RIS images and logonscripts. We should be done this weekend so that'll help me free up some time for next week in which I'll do my best to complete the form request. |
||||||||
|
|
|||||||
not a problem apronk, i think we all understand how work work is and hope to see your code next week. |
||||||||
|
|
|||||||
It also helps if you are using the Beta version of KFD |
||||||||
|
|
|||||||
I also had a problem working with panels and splitters. The objects ended always where I did not want them. But in the KFD help file is a good explanation titled "Splitter". Maybe take a look there. |
||||||||
|
|
|||||||
- How do I know the size of the form after the size changed? - Can I add an icon in the menu (for Exit)? |
||||||||
|
|
|||||||
How do I know the size of the form after the size changed? Look into the '.SizeChanged' event for the form. In the function that you define for this event, look into the '.Width' and '.Height' property for the form. Can I add an icon in the menu (for Exit)? I have not done that myself and I don't think Shawn has built that in as of yet. If you can figure out how that would be great and others can learn from your example. |
||||||||
|
|
|||||||
Quote: The minimum size of the form should not be allowed to be smaller than 600,400 (Width, Height) if it is resized. In KFD there is the Form property "MinimumSize" - Of course this sounded like the perfect solution to the requirement... However it appears that this is not implemented at this time. Or am I missing something? When looking at the TypeLibrary it does not show this property. So is the only solution to watch the SizeChanged event? |
||||||||
|
|
|||||||
SizeChanged event, yes or i supose you could use a timer. |
||||||||
|
|
|||||||
Well I almost have it, And Benny can I say .... Gee thanks... I thought it was going to be easy |
||||||||
|
|
|||||||
The next lesson sould be a little harder, but I don't think it will be anything that everyone can't handle. I do think there will be some questions though, and that's ok. |
||||||||
|
|
|||||||
Ok, I have mine ready... I will await the open coding section now. |
||||||||
|
|
|||||||
Nice going Garg, I still struggle with letting the form remember last position and Splitter distances which was soooo easy with classic kf... I will try to get a form by the end of the week but I might give in before and stick with the tools I know |
||||||||
|
|
|||||||
Jochen, splitter distance http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=170867&page=1#Post171243 remember form size (there is more than one way to Dim a variable). |
||||||||
|
|
|||||||
there is? |
||||||||
|
|
|||||||
I don't know if the way that I came up with is the "proper way", but it seems to maintain position upon a resize. I am sure that once we post, there will be lots of comments on how things are done. |
||||||||
|
|
|||||||
well, once it's public, I shall take the code by benny so can participate in part2 |
||||||||
|
|
|||||||
Jooel, I know you can come up with a better way than I have. I know you hate dealing with the GUI but heck KFD does the hard part for you. I will be disapointed if you don't post your own code |
||||||||
|
|
|||||||
uhm. look at your task. it would take me a day with my belowed notepad and lots of beer to be able to accomplish that many gui objects. I'm afraid I must skip this one, skippy. |
||||||||
|
|
|||||||
Question: does $system.Icon.FromBase64String() handle strings that are converted from bmp files ? I can't beat this to work : Code: break on $system = createobject('Kixforms.System') $form = $system.Form() $form.Icon = $system.Icon.FromBase64String(String_FormIcon()) $form.Show while $form.Visible $_ = execute($system.Application.DoEvents) loop function String_FormIcon() $String_FormIcon = " Qk02AwAAAAAAADYAAAAoAAAAEAAAABAAAAABABgAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//// ////////////////////////////////wMDAwMDAwMDA////////AAAAAAAA//////////// ////////////wMDAwMDAAAAAAAAAAAAAwMDA////////AAAAAAAA//////////////////// AAAAAAAAAAAAAAAAAAD/AAAAwMDA////////AAAAAAAA////////////////////AAAAwMDA ////AAAAAAAAAAAA////////////AAAAAAAA////////////////////AAAAwMDA//////// wMDAwMDAwMDA////////AAAAAAAA////////////////////AAAAwMDAwMDAAAAAAAAAAAAA wMDA////////AAAAAAAA////////////////////AAAAAAAAAAAAAAAAAP8AAAAAwMDA//// ////AAAAAAAA////////////////////AAAAwMDAwMDAAAAAAAAAAAAA////////////AAAA ////wMDAwMDAwMDAwMDAAAAAAAAAAAAAwMDA////////////////////////AAAA////AAAA AAAAAAAAAAAAAAAAAP//AAAAwMDA////////////////////////AAAA////AAAAwMDA//// ////AAAAAAAAAAAA////////////////////////////AAAA////AAAAwMDA//////////// ////////////////////////////////////AAAAAAAAAAAAAAAAwMDAAAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAAAAAAA//8AAAAAwMDAAAD/AAD/AAD/AAD/AAD/AAD/ AAD/AAD/AAD/AAD/AAD/AAAAAAAAAAAAAAAAwMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAA " endfunction the string results from 6-FormIcon.png you attached earlier converted to (saved as) bitmap. |
||||||||
|
|
|||||||
I used the png to generate the string. Works as a charm. You also should write an extra line at the end of your function $String_FormIcon = $System.Bitmap.FromBase64String($String_FormIcon) |
||||||||
|
|
|||||||
Nay, neither this nor the other shows other than the default form icon. Please don't tell me that this is due to coding on a W2K Prof. box edit: Quote: You also should write an extra line at the end of your function $String_FormIcon = $System.Bitmap.FromBase64String($String_FormIcon) Why should I do this ? It makes no sense ! |
||||||||
|
|
|||||||
Why you should do that. Well, If I don't, I do not get an icon. I don't know how far I can go posting script, because Benny said Originally Posted By: Benny96 Do not post solutions until after solution post time is announced. I cannot believe that W2K is an issue. Also use the PNG to create the string, not your converted bmp. |
||||||||
|
|
|||||||
I would say, oh wait i did: Quote: Collaboration is not allowed until after solution post time is announced. Jochen, Form.Icon, KFD will show you the way. |
||||||||
|
|
|||||||
I to had that issue until I read more on the Form.Icon. It was a bit frustrating to say the least. |
||||||||
|
|
|||||||
I'll give this a go... (as soon as I figure out how to place the button text to the right and the ico to the left) |
||||||||
|
|
|||||||
The thing that really annoys me is that the code is exactly the same as in Shawns functioning post here. The only difference is the base64 string edit: btw, I never used any form designer of any kind, and I won't start now |
||||||||
|
|
|||||||
If you would use the KFD and add an icon to a form, you would get an example script that you can use... Anyway, that is how I did it. |
||||||||
|
|
|||||||
lol. You don't get it, eh? I have a sample script that works! Just follow the link I posted above and run Shawns sample ... See? it works! Now compare Shawns script to the one I posted... any difference? I'd say the only difference is the base64 string itself. So it must have something to do either with the size (aspect ratio) of the input bitmap or with something else I am doomed to overlook atm I am just the type of guy who likes to understand things rather than to accept silver platter solutions from forms designers and stuff ... more fun, you know maybe Shawns sample strings are converted (real) *.ico files ??? |
||||||||
|
|
|||||||
Aahhh... *done* |
||||||||
|
|
|||||||
Jochen, Shawn's example does work fine, the problem you are having is that the Base64 string is created from a .ico file. Shawn's example with the correct Base64 string: Code: Break On $System = CreateObject("Kixforms.System") $Form = $System.Form() $Form.Text = "Demo" $Form.Icon = $System.Icon.FromBase64String(UserIconString()) $Form.Center $Form.Show While $Form.Visible $= Execute($System.Application.DoEvents) Loop Exit 0 Function UserIconString() $UserIconString = " AAABAAEAEBAQAAAAAAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD/ /wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAP/////4iP8A////iAAI/wD///AACQj/AP//8I 8AD/8A///wj/iI/wD///CIAAj/AP//8AAKCP8A///wiAAP/w+IiAAI////DwAACwj///8PCP 8AD////w8I////////AACJmZmZmZkA4ImZmZmZmQAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" EndFunction |
||||||||
|
|
|||||||
Yap, that was the conclusion that I came up with in the mean time ... Will have to experiment with .Ico format this evening when I get to my home boxes which have a bit more than mspaint on it or digging another way around it ... there are other methods than FromBase64String that I have not tried yet. When did you say the deadline was ? |
||||||||
|
|
|||||||
I have not said yet but I think that Friday morn would be good. |
||||||||
|
|
|||||||
Dang... Friday - LOL - I suppose that is the end of the week Was here at work till 02:30 and might be late again tonight (new database error reported I might have to fix tonight). Oh well. I'll "borrow" from the others when they post maybe . |
||||||||
|
|
|||||||
Uh oh, I completely forgot about this. Will get on it this week. May just have a partial working on form. |
||||||||
|
|
|||||||
Originally Posted By: Benny69 The only Events and Functions you should work on/create is for:
Is it allowed to add a function to hinder the possibility of setting the splitter to high or to low? (or is that something for a later lesson?) /Viggen |
||||||||
|
|
|||||||
you may |
||||||||
|
|
|||||||
You may post your code at 06:00 am GMT Friday Morn. |
||||||||
|
|
|||||||
Oh gee thanks Benny - That is 0100 for me I should have mine in by 1600 GMT |
||||||||
|
|
|||||||
thats fine, i am sure they will trickle in all day, its just a start time. |
||||||||
|
|
|||||||
Code: ;region Set Code Options ;Set Break to On if not in Logon Mode. If NOT @LOGONMODE Break On Else Break Off EndIf ;Set Code Options to On Dim $SO $SO=SetOption("Explicit", "ON") $SO=SetOption("NoMacrosInStrings", "ON") $SO=SetOption("NoVarsInStrings", "ON") $SO=SetOption("WrapAtEOL", "ON") ;endregion Set Code Options Global $System $System = CreateObject("Kixforms.System") If NOT $System $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16) Quit @ERROR EndIf Global $frmRegRun Dim $frmRegRunWidth, $frmRegRunHeight $frmRegRunWidth = 600 $frmRegRunHeight = 400 Dim $nul, $Imagelist, $MainMenu, $MenuItem1, $MenuItem2 Dim $Panel1, $Panel2, $Panel3, $Listview1, $Listview2, $Splitter1 Dim $ListView1Column0, $ListView1Column1, $ListView2Column0, $ListView2Column1 Dim $ComboBox1, $Label1 Dim $btnExit, $btnDelete, $btnRefresh, $btnRestore, $btnBackup, $btnSave $frmRegRun = $System.Form() $frmRegRun.StartPosition = 1 ;FormStartPosition_CenterScreen $frmRegRun.Size = $System.Size($frmRegRunWidth,$frmRegRunHeight) ;(Width,Height) $frmRegRun.Text = "Windows Registry Run [Project 01 - Lesson 01]" $frmRegRun.Icon = $System.Icon.FromBitmap(frmRegRunIcon()) $frmRegRun.SizeChanged = "ChangeSize($frmRegRunWidth, $frmRegRunHeight)" $ImageList = $System.ImageList() $nul = $ImageList.Images.AddStrip(MenuBitmap()) $MainMenu = $System.MainMenu() $MenuItem1 = $MainMenu.MenuItems.Add($System.MenuItem("File")) $MenuItem2 = $MenuItem1.MenuItems.Add($System.MenuItem("Exit")) $MenuItem2.Click = "QuitProgram()" $frmRegRun.Menu = $MainMenu $Panel1 = $System.Panel() $Panel1.BorderStyle = 2 ;Fixed3D $Panel1.Dock = 5 ;Fill $nul = $frmRegRun.Controls.Add($Panel1) $ListView2 = $System.ListView() $ListView2.Dock = 5 ;Fill $ListView2.Font = $System.Font("Microsoft Sans Serif",10,0) ;Regular $ListView2.GridLines = -1 ;True $ListView2.View = $System.View_Details $nul = $Panel1.Controls.Add($ListView2) $ListView2Column0 = $ListView2.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left)) $ListView2Column1 = $ListView2.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Left)) $Label1 = $System.Label() $Label1.Dock = 1 ;Top $Label1.Text = "Entries to delete" $Label1.TextAlign = 32 ;MiddleCenter $nul = $Panel1.Controls.Add($Label1) $Splitter1 = $System.Splitter() $Splitter1.BackColor = $System.Color.FromName("ActiveCaption") $Splitter1.Dock = 1 ;Top $Splitter1.Height = 3 $nul = $frmRegRun.Controls.Add($Splitter1) $Panel2 = $System.Panel() $Panel2.BorderStyle = 2 ;Fixed3D $Panel2.Dock = 1 ;Top $Panel2.Height = 195 $nul = $frmRegRun.Controls.Add($Panel2) $ListView1 = $System.ListView() $ListView1.Dock = 5 ;Fill $ListView1.Font = $System.Font("Microsoft Sans Serif",10,0) ;Regular $ListView1.GridLines = -1 ;True $ListView1.View = $System.View_Details $nul = $Panel2.Controls.Add($ListView1) $ListView1Column0 = $ListView1.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left)) $ListView1Column1 = $ListView1.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Left)) $ComboBox1 = $System.ComboBox() $ComboBox1.Dock = 1 ;Top $ComboBox1.DropDownWidth = 500 $ComboBox1.IntegralHeight = 0 $ComboBox1.ItemHeight = 13 $ComboBox1.Text = "" $nul = $Panel2.Controls.Add($ComboBox1) $Panel3 = $System.Panel() $Panel3.BorderStyle = 2 ;Fixed3D $Panel3.Dock = 3 ;Left $Panel3.Width = 90 $nul = $frmRegRun.Controls.Add($Panel3) $btnExit = $System.Button() $btnExit.Dock = 1 ;Top $btnExit.ImageAlign = 16 ;Middle,Left $btnExit.Text = "Exit" $btnExit.TextAlign = 64 ;MiddleRight $btnExit.ImageList = $ImageList $btnExit.ImageIndex = 0 $btnExit.Click = "QuitProgram()" $nul = $Panel3.Controls.Add($btnExit) $btnDelete = $System.Button() $btnDelete.Dock = 1 ;Top $btnDelete.ImageAlign = 16 ;Middle,Left $btnDelete.Text = "Delete" $btnDelete.TextAlign = 64 ;MiddleRight $btnDelete.ImageList = $ImageList $btnDelete.ImageIndex = 1 $nul = $Panel3.Controls.Add($btnDelete) $btnRefresh = $System.Button() $btnRefresh.Dock = 1 ;Top $btnRefresh.ImageAlign = 16 ;Middle,Left $btnRefresh.Text = "Refresh" $btnRefresh.TextAlign = 64 ;MiddleRight $btnRefresh.ImageList = $ImageList $btnRefresh.ImageIndex = 2 $nul = $Panel3.Controls.Add($btnRefresh) $btnRestore = $System.Button() $btnRestore.Dock = 1 ;Top $btnRestore.ImageAlign = 16 ;Middle,Left $btnRestore.Text = "Restore" $btnRestore.TextAlign = 64 ;MiddleRight $btnRestore.ImageList = $ImageList $btnRestore.ImageIndex = 3 $nul = $Panel3.Controls.Add($btnRestore) $btnBackup = $System.Button() $btnBackup.Dock = 1 ;Top $btnBackup.ImageAlign = 16 ;Middle,Left $btnBackup.Text = "Backup" $btnBackup.TextAlign = 64 ;MiddleRight $btnBackup.ImageList = $ImageList $btnBackup.ImageIndex = 4 $nul = $Panel3.Controls.Add($btnBackup) $btnSave = $System.Button() $btnSave.Dock = 1 ;Top $btnSave.ImageAlign = 16 ;Middle,Left $btnSave.Text = "Save" $btnSave.TextAlign = 64 ;MiddleRight $btnSave.ImageList = $ImageList $btnSave.ImageIndex = 5 $nul = $Panel3.Controls.Add($btnSave) $frmRegRun.Show ;Displays the Form While $frmRegRun.Visible $Nul = Execute($frmRegRun.DoEvents()) Loop Exit 0 Function frmRegRunIcon() $frmRegRunIcon = " iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1B AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA AHlJREFUOE+NkgEOwCAIA/3/q/gZY+IqCtoRk2HY0UJs7QsRQc4SVfvDAPvcz9LoL6BobxmL V2EDIFqyE4jmumQfKcUArIaIS6sBdxXD28ctozraZWA6XO0dgU0B89wAl8VsfiVAXjGfwXsS S3CSV1wrxKXVM7DHvNQfo/mQ/8A92p4AAAAASUVORK5CYII=" $frmRegRunIcon = $System.Bitmap.FromBase64String($frmRegRunIcon) EndFunction Function MenuBitmap() $MenuBitmap = " iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAYAAADpunr5AAAACXBIWXMAAA7DAAAOwwHHb6hk AAAGmElEQVR4nO2YW2wU5xmGv5vcRFGVq14lUitVucAkWTxSaKOgWKIHkcgVAdGGQhungRVN IpTWmKQgYqMSWpI0NJUWexrAFBI7DjQGLT4sxudl7bWXGIxhfWBNfdj1OevYpix22KcX49md 3Z2xHUBqVfWTXmk08//fq/99//m+f0bk//HfEX+pHOWPJdcXxf6iLv4X+f/j8YFzkGg0ilnc /hqmb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g8K56 QG1tl7kBeR/WMTQ8Eqv5o/W1sZ2Pou0876C2+Ope2LrNYSlq6AlhaB6heQQXMUHnn5jntzLA FQin8isq8uol5HediYIpKrKxNhFWBmR3aU17c4O2u3U8nXSc1d+kpB6wZk0p+/ZV43A0c+iQ l0OHvOTnt5Cf30JBQSsFBa2oqo/sbBdZWZ5UA/a856JvIMjwNIS64iUoWHAwdt1ZWMi5AJT3 wMu//qupoH2PCzr6Ddf/nIeVATq/LrxecrLdWtlzBcKsOJmB67oFv6Jq4m1uSD3xWME4Ltko HRlFiePsPiTLk2KA3e7DbvexZYubXbs85Oa2snt3E6+9VoHd7iQ7u5YXX6wgM9NpbsDuP5XR 2zdA/yTcCGtN+NYGG74gBI4XEsrOorpXW7yzG17KOpgiZu9ywQirZ2YGJPPrBjxWbGNrTR4P HX0YUcWaX1E1sfQ6v9QPraWGoiJrSuMN2BBGAzIzVbzeQAyVlW5crkb8/gCKoqIoqnkJemvv 5/i7e+mZgM5xuDR/2tBrrr7zS/1w6hps+uX7sQRX0wS/AV1p5iL3LBe6l5s/N/L7xyDbfTDh 9LO2/A1L/gSRNjdoIv3Y5MPqbsN4/NT7gyFSDRjg+efPsGNHMY2NjQQCAWZnZxcxIPcUHV0B OsfhyggpNV/feaeuwadXYNOm92IJOtIEHVctxNejM03QYcZ/bUzjbx7Q8NL5PHa6CynvgdOd 5vwJ8dThRBPuNRQVWXXC9ANMj2QDnM6LrFtXyb59FTHxJycnFzYgZ1cxX3R0LbjzT16FE5fh 2CXY+It3ExJcXiZcXra03xBXlgnt87hf/CmiGX813EvoJ6FVJyzzJRvgcBzH4WjG7Y6L39vb u4gBb31CZc0QFefDGqq+pPzcBOWuccoqxyirGOVs+Qhny4Zxnh1aWIAlRLJh953/fvaARX7e JRtQUlKSsPNDoRB+v9/UgH8DM43DgdT9MCYAAAAASUVORK5CYII=" $MenuBitmap = $System.Bitmap.FromBase64String($MenuBitmap) EndFunction Function ChangeSize($frmRegRunWidth, $frmRegRunHeight) Dim $blnChangeSize $blnChangeSize = 0 If $frmRegRun.Width < $frmRegRunWidth $blnChangeSize = -1 Else $frmRegRunWidth = $frmRegRun.Width EndIf If $frmRegRun.Height < $frmRegRunHeight $blnChangeSize = -1 Else $frmRegRunHeight = $frmRegRun.Height EndIf If $blnChangeSize = -1 $frmRegRun.Size = $System.Size($frmRegRunWidth,$frmRegRunHeight) EndIf EndFunction Function QuitProgram Quit 0 EndFunction |
||||||||
|
|
|||||||
Our SAN broke down last night, so I haven't got the "splittermoved()"-function in Code: ;************ Options ************************ If Not @LogonMode Break On EndIf Dim $SO $SO=SetOption("NoMacrosInStrings", "ON") $SO=SetOption("NoVarsInStrings", "ON") $SO=SetOption("Explicit", "ON") Global $nul, $System, $LSL01, $MainMenu, $List_Panel, $RegList_ListView, $Reg_ComboBox, $Splitter, $RegList_ListViewColumn, $FW, $FH Global $Del_Panel, $DelList_ListView, $DelList_Label, $Btn_Panel, $FileMenu, $Exit, $DelList_ListViewColumn, $Exit_Button Global $icons, $IconList, $FormIcon, $ControlIcons, $Save_Button, $Backup_Button, $Restore_Button, $Refresh_Button, $Delete_Button ; Form dimensions $FW = 600 ;Form Width $FH = 400 ;Form Height ;********************************************* ;************ Main Form ************************************************************** $System = CreateObject("Kixforms.System") If Not $System $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16) Quit() EndIf ;****************************************** $LSL01 = $System.Form() $LSL01.Icon = $System.Icon.FromBitmap(FormIcon()) $LSL01.StartPosition = 1 $LSL01.Size = $System.Size($FW,$FH) $LSL01.Text = "Windows Registry Run [Project 01 - Lesson 01]" $LSL01.SizeChanged = "Size()" ;****************************************** ;****************************************** $Icons = ControlIcons() $IconList = $System.ImageList() $IconList.ImageSize = 16,16 $IconList.TransparentColor = 0,0,0 $nul = $IconList.Images.AddStrip($Icons) ;****************************************** ;****************************************** $MainMenu = $System.MainMenu() $FileMenu = $MainMenu.MenuItems.Add($System.MenuItem("File")) $Exit = $FileMenu.MenuItems.Add($System.MenuItem("Exit")) $Exit.Click = "ExitForm()" $LSL01.Menu = $MainMenu ;****************************************** ;****************************************** $List_Panel = $System.Panel() $List_Panel.BorderStyle = 2 $List_Panel.Dock = 5 $nul = $LSL01.Controls.Add($List_Panel) ;****************************************** ;****************************************** $RegList_ListView = $System.ListView() $RegList_ListView.Dock = 5 $RegList_ListView.FullRowSelect = -1 $RegList_ListView.GridLines = -1 $RegList_ListView.View = $System.View_Details $nul = $List_Panel.Controls.Add($RegList_ListView) ;****************************************** ;****************************************** $RegList_ListViewColumn = $RegList_ListView.Columns.Add($System.ColumnHeader("Entry",120,$System.HorizontalAlignment_Left)) $RegList_ListViewColumn = $RegList_ListView.Columns.Add($System.ColumnHeader("Value",120,$System.HorizontalAlignment_Left)) ;****************************************** ;****************************************** $Reg_ComboBox = $System.ComboBox() $Reg_ComboBox.Dock = 1 $Reg_ComboBox.ItemHeight = 15 $Reg_ComboBox.Text = "" $nul = $List_Panel.Controls.Add($Reg_ComboBox) ;****************************************** ;****************************************** $Splitter = $System.Splitter() $Splitter.Dock = 2 $Splitter.Height = 4 $nul = $LSL01.Controls.Add($Splitter) ;****************************************** ;****************************************** $Del_Panel = $System.Panel() $Del_Panel.BorderStyle = 2 $Del_Panel.Dock = 2 $Del_Panel.Height = ($LSL01.Height/2)-20 ; Centers the splitter (almost...) if "MainMenu" is 18px high (how high is it?) $nul = $LSL01.Controls.Add($Del_Panel) ;****************************************** ;****************************************** $DelList_ListView = $System.ListView() $DelList_ListView.Dock = 5 $DelList_ListView.FullRowSelect = -1 $DelList_ListView.GridLines = -1 $DelList_ListView.View = $System.View_Details $nul = $Del_Panel.Controls.Add($DelList_ListView) ;****************************************** ;****************************************** $DelList_ListViewColumn = $DelList_ListView.Columns.Add($System.ColumnHeader("Entry",120,$System.HorizontalAlignment_Left)) $DelList_ListViewColumn = $DelList_ListView.Columns.Add($System.ColumnHeader("Value",120,$System.HorizontalAlignment_Left)) ;****************************************** ;****************************************** $DelList_Label = $System.Label() $DelList_Label.BorderStyle = 2 $DelList_Label.Dock = 1 $DelList_Label.Height = 20 $DelList_Label.Text = "Entries to Delete" $DelList_Label.TextAlign = 32 $nul = $Del_Panel.Controls.Add($DelList_Label) ;****************************************** ;****************************************** $Btn_Panel = $System.Panel() $Btn_Panel.BorderStyle = 2 $Btn_Panel.Dock = 3 $Btn_Panel.Width = 89 $nul = $LSL01.Controls.Add($Btn_Panel) ;****************************************** ;****************************************** $Save_Button = $System.Button() $Save_Button.Height = 26 $Save_Button.Left = 0 $Save_Button.Text = "Save " $Save_Button.ImageAlign = 16 $Save_Button.TextAlign = 64 $Save_Button.Top = 0 $Save_Button.Width = 85 $Save_Button.ImageList = $IconList $Save_Button.ImageIndex = 5 $nul = $Btn_Panel.Controls.Add($Save_Button) ;****************************************** ;****************************************** $Backup_Button = $System.Button() $Backup_Button.Height = 26 $Backup_Button.Left = 0 $Backup_Button.Text = "Backup " $Backup_Button.ImageAlign = 16 $Backup_Button.TextAlign = 64 $Backup_Button.Top = 26 $Backup_Button.Width = 85 $Backup_Button.ImageList = $IconList $Backup_Button.ImageIndex = 4 $nul = $Btn_Panel.Controls.Add($Backup_Button) ;****************************************** ;****************************************** $Restore_Button = $System.Button() $Restore_Button.Height = 26 $Restore_Button.Left = 0 $Restore_Button.Text = "Restore " $Restore_Button.ImageAlign = 16 $Restore_Button.TextAlign = 64 $Restore_Button.Top = 52 $Restore_Button.Width = 85 $Restore_Button.ImageList = $IconList $Restore_Button.ImageIndex = 3 $nul = $Btn_Panel.Controls.Add($Restore_Button) ;****************************************** ;****************************************** $Refresh_Button = $System.Button() $Refresh_Button.Height = 26 $Refresh_Button.Left = 0 $Refresh_Button.Text = "Refresh " $Refresh_Button.ImageAlign = 16 $Refresh_Button.TextAlign = 64 $Refresh_Button.Top = 78 $Refresh_Button.Width = 85 $Refresh_Button.ImageList = $IconList $Refresh_Button.ImageIndex = 2 $nul = $Btn_Panel.Controls.Add($Refresh_Button) ;****************************************** ;****************************************** $Delete_Button = $System.Button() $Delete_Button.Height = 26 $Delete_Button.Left = 0 $Delete_Button.Text = "Delete " $Delete_Button.ImageAlign = 16 $Delete_Button.TextAlign = 64 $Delete_Button.Top = 104 $Delete_Button.Width = 85 $Delete_Button.ImageList = $IconList $Delete_Button.ImageIndex = 1 $nul = $Btn_Panel.Controls.Add($Delete_Button) ;****************************************** ;****************************************** $Exit_Button = $System.Button() $Exit_Button.Height = 26 $Exit_Button.Left = 0 $Exit_Button.Text = "Exit " $Exit_Button.ImageAlign = 16 $Exit_Button.TextAlign = 64 $Exit_Button.Top = 130 $Exit_Button.Width = 85 $Exit_Button.ImageList = $IconList $Exit_Button.ImageIndex = 0 $Exit_Button.Click = "ExitForm()" $nul = $Btn_Panel.Controls.Add($Exit_Button) ;****************************************** $LSL01.Show While $LSL01.Visible $Nul = Execute($LSL01.DoEvents()) Loop Exit 0 ;************************************************************************************* ;************************************************************************************* ;********************************** Function Size() ; Check if the form width or hight is smaller than allowed ; If it is, reset to "startsize" If $LSL01.Width < $FW OR $LSL01.Height < $FH $LSL01.Width = $FW $LSL01.Height = $FH $Del_Panel.Height = ($LSL01.Height/2)-20 Endif ; Check if the splitter is "out of bounds" ; If It is, then center the splitter again. If $Del_Panel.Top < ($List_Panel.Top+20) $Del_Panel.Height = ($LSL01.Height/2)-20 Endif Endfunction ;********************************** ;********************************** Function ExitForm() $LSL01.Hide $System = "" Exit 0 Endfunction ;********************************** ;************************************************************************************* ;********************* Icons ********************************************************* ;******************************************************************** Function ControlIcons() $ControlIcons = "iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAYAAADpunr5AAAACXBIWXMAAA7DAAAOwwHHb6hk AAAGmElEQVR4nO2YW2wU5xmGv5vcRFGVq14lUitVucAkWTxSaKOgWKIHkcgVAdGGQhungRVN IpTWmKQgYqMSWpI0NJUWexrAFBI7DjQGLT4sxudl7bWXGIxhfWBNfdj1OevYpix22KcX49md 3Z2xHUBqVfWTXmk08//fq/99//m+f0bk//HfEX+pHOWPJd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;******************************************************************** ;******************************************************************** Function FormIcon() $FormIcon = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1B AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA AHlJREFUOE+NkgEOwCAIA/3/q/gZY+IqCtoRk2HY0UJs7QsRQc4SVfvDAPvcz9LoL6BobxmL V2EDIFqyE4jmumQfKcUArIaIS6sBdxXD28ctozraZWA6XO0dgU0B89wAl8VsfiVAXjGfwXsS S3CSV1wrxKXVM7DHvNQfo/mQ/8A92p4AAAAASUVORK5CYII=" $FormIcon = $System.Bitmap.FromBase64String($FormIcon) Endfunction ;******************************************************************** ;************************************************************************************* |
||||||||
|
|
|||||||
it's friday morning already ? Gawd, workdays are loaded with workstuff these days. Spare time is half used with visiting my father each day at a ICU since weeks and stuff... I may or may not post at sunday or so |
||||||||
|
|
|||||||
Witto, Form layout Well done. Just a few small things; Dim/Global variables will be discussed in greater detail in Lesson 02. By default 'Break' is set to off, so 'Else Break Off' is redundant and not needed. When using forms you don't want the console to show up unless you are debugging, so '$SO=SetOption("WrapAtEOL", "ON")' should not be set in the Options. Variable names are Not descriptive, example what is the difference between $ListView1 And $ListView2, what are they for? $Splitter1/$ComboBox1/$Label1 eludes that there is more that one. Lacking in comments, particularly the controls (what is each control for, what do they do). |
||||||||
|
|
|||||||
Viggen, Form layout Well done. Just a few small things; Dim/Global variables will be discussed in greater detail in Lesson 02. Lacking in comments, particularly the controls (what is each control for, what do they do). |
||||||||
|
|
|||||||
[code] If Not @LogonMode Break On EndIf ;Declare Variables that will be used throughout Global $SO, $Nul ;Set Code Options to On $SO=SetOption("NoMacrosInStrings", "ON") $SO=SetOption("NoVarsInStrings", "ON") $SO=SetOption("Explicit", "ON") ;Declare Variables for the form DIM $MainMenu,$MenuItem1,$MenuItem2 DIM $Panel_Dock[],$Panel_Height[],$Panel_Left[],$Panel_Top[] DIM $Button_Text,$Button_Top[],$Label1 DIM $Splitter1,$ListView2Column[1],$ListView1Column[1] DIM $Button_Click[],$ControlStackImageList Global $System,$Form_Main,$Panel[2],$ListView1,$ListView2,$ComboBox1,$Button[5] ;Array build information ;Could probably make MultiDimensional array's but I kept losing myself $Panel_dock = 3,"",5 $Panel_Height = "",332,"" $Panel_Left = "",80,"" $Panel_Top = "",21,"" $Button_Text = "Exit","Delete","Refresh","Restore","Backup","Save" $Button_Top = 120,96,72,48,24,0 $Button_Click = "","","","","","IWantOut()" ;Check for existence of KiXForms $System = CreateObject("Kixforms.System") If Not $System $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16) Quit() EndIf $nul = $System.Application.EnableVisualStyles ;Build the Form $Form_Main = $System.Form() $Form_Main.StartPosition = 1 $Form_Main.Size = $System.Size(600,400) $Form_Main.Text = "Project1 - Lesson 1" $Form_Main.SizeChanged = "Resize()" $Form_Main.Icon = $System.Icon.FromBase64String(FormImage()) ;Build the menu bar $MainMenu = $System.MainMenu() $MenuItem1 = $MainMenu.MenuItems.Add($System.MenuItem("File")) $MenuItem2 = $MenuItem1.MenuItems.Add($System.MenuItem("Exit")) $MenuItem2.Click = "IWantOut()" $Form_Main.Menu = $MainMenu ;Build the panels ;Panel 0 = Left panel with Control Stack ;Panel 1 = Is set to fill the rest of the fomr ;Panel 2 = Panel within Panel 1 For $SO = 0 To UBound($Panel) $Panel[$SO] = $System.Panel() $Panel[$SO].BorderStyle = 1 $Panel[$SO].Dock = $Panel_Dock[$SO] $Panel[$SO].Left = $Panel_Left[$SO] $Panel[$SO].Top = $Panel_Top[$SO] $Panel[$SO].Height = $Panel_Height[$SO] Next ;Add Control Stack containing panel $Nul = $Form_Main.Controls.Add($Panel[0]) ;Build the ImageList for the ControlStack $ControlStackImageList = $System.Imagelist() $ControlStackImageList.ImageSize = $System.Size(16,16) $Nul = $ControlStackImageList.Images.AddStrip($System.Bitmap.FromBase64String(ControlStackImageList())) ;Build the Buttons for the Control Stack ;Buttons are built from the bottom up ;See definition of Button_Text[] Array for clarification For $SO = 0 to Ubound($Button) $Button[$SO] = $System.Button() $Button[$SO].Left = 0 $Button[$SO].TextAlign = 64 $Button[$SO].Top = $Button_Top[$SO] $Button[$SO].Text = $Button_Text[$SO] $Button[$SO].Click = $Button_Click[$SO] $Button[$SO].ImageList = $ControlStackImageList $Button[$SO].ImageAlign = 16 $Button[$SO].ImageIndex = $SO $Nul = $Panel[0].Controls.Add($Button[$SO]) Next ;Add the ComboBox $ComboBox1 = $System.ComboBox() $ComboBox1.DropDownWidth = 512 $ComboBox1.IntegralHeight = 0 $ComboBox1.ItemHeight = 13 $ComboBox1.Left = 79 $ComboBox1.Text = "" $ComboBox1.Top = 0 $nul = $Form_Main.Controls.Add($ComboBox1) ;Add Two Panels that will allow for splitting $Nul = $Form_Main.Controls.Add($Panel[1]) ;Add the secondary panel to the one just created $Nul = $Panel[1].Controls.Add($Panel[2]) ;Add the Label $Label1 = $System.Label() $Label1.BorderStyle = 1 $Label1.Dock = 1 $Label1.Text = "Entries to Delete" $Label1.TextAlign = 32 $nul = $Panel[2].Controls.Add($Label1) ;Insert the Bottom Listview First to establish for the Splitter $ListView2 = $System.ListView() $ListView2.GridLines = -1 ;True $ListView2.Left = 0 $ListView2.Top = 22 $ListView2.View = $System.View_Details $nul = $Panel[2].Controls.Add($ListView2) ;Add in the Splitter $Splitter1 = $System.Splitter() $Splitter1.Dock = 1 ;Top $Splitter1.Height = 3 $nul = $Panel[1].Controls.Add($Splitter1) ;Now we can add the top Listview $ListView1 = $System.ListView() $ListView1.Dock = 1 ;Top $ListView1.GridLines = -1 ;True $ListView1.View = $System.View_Details $nul = $Panel[1].Controls.Add($ListView1) ;Set up Column headers for ListViews $ListView2Column[0] = $ListView2.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left)) $ListView2Column[1] = $ListView2.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Center)) $ListView1Column[0] = $ListView1.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left)) $ListView1Column[1] = $ListView1.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Center)) ;Set the widths of everything to match the form $Panel[0].Width = 79 Resize() $Form_Main.Show ;Displays the Form While $Form_Main.Visible $Nul = Execute($Form_Main.DoEvents()) Loop Exit 0 ;================================================================================================ ; Functions ;================================================================================================ Function Resize() DIM $Width If $Form_Main.Width => 600 $Width = $Form_Main.Width - 86 Else $Form_Main.Width = 600 EndIf If $Form_Main.Height < 400 $Form_Main.Height = 400 EndIf $Panel[1].Width = $Width $Panel[2].Width = $Width $ComboBox1.Width = $Width $ListView2.Width = $Width $ListView1.Width = $Width $Panel[1].Height = $Form_Main.Height $Panel[2].Height = $Form_Main.Height - ($ListView1.Height - 5) $ListView2.Height = $Panel[2].Height EndFunction ;===================================== Function IWantOut() Quit 0 EndFunction ;================================================================================================ ; Image Strings ;================================================================================================ Function ControlStackImageList() $ControlStackImageList = " iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAYAAADpunr5AAAACXBIWXMAAA7DAAAO wwHHb6hkAAAGmElEQVR4nO2YW2wU5xmGv5vcRFGVq14lUitVucAkWTxSaKOgWKIH kcgVAdGGQhungRVNIpTWmKQgYqMSWpI0NJUWexrAFBI7DjQGLT4sxudl7bWXGIxh fWBNfdj1OevYpix22KcX49md3Z2xHUBqVfWTXmk08//fq/99//m+f0bk//HfEX+p HOWPJdcXxf6iLv4X+f/j8YFzkGg0ilnc/hqmbmvI+8cgfyhsTxDhTroQVYQ76XLX 4twLf0IoKt/6UREPPHMMUVTzcYpq/cxqrBFJkbPfRUZGEdPT04vC5Wpn48ZaMjOT 8vz5dB9zc3Omi4/MQfiWhk2V8JsTfbyd3xJL8HW6YMSSFpYU98JvFOpXJ6f4eTk8 VgQPHhg3F23lEWR1Sfy+ovLtzFOp4xQVefYTZIsXyQsir7cjK4+kjPsmBpw7d8Xc gHc/6yYSicQWH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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB AQEBAQEBAQEGBgYBAQAAAQEBAQEBBgYAAAAGAQEAAAEBAQEBAAAAAAMABgEBAAAB AQEBAQAGAQAAAAEBAQAAAQEBAQEABgEBBgYGAQEAAAEBAQEBAAYGAAAABgEBAAAB AQEBAQAAAAACAAYBAQAAAQEBAQEABgYAAAABAQEAAQYGBgYAAAAGAQEBAQEBAAEA AAAAAAUABgEBAQEBAQABAAYBAQAAAAEBAQEBAQEAAQAGAQEBAQEBAQEBAQEBAAAA AAYDAwMDAwMDAwMDAwAABAAGAwMDAwMDAwMDAwMAAAAABgAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA=" EndFunction [/code] |
||||||||
|
|
|||||||
Gargoyle, Form layout looks nice, but when the form is resized larger you can see the size of the 'ListView'(s) and other internal controls remain small until the form border is released. Comments, well done and easy to follow. Construction of identical controls, very creative well done. The arrays might be a little over kill. Variable names are Not descriptive, example what is the difference between $ListView1 And $ListView2, what are they for? $Splitter1/$ComboBox1/$Label1 eludes that there is more that one. |
||||||||
|
|
|||||||
I was unable to determine how to make the listviews resize as you resize the form. Any tips would be appreciated. |
||||||||
|
|
|||||||
Gargoyle, When you set the '.Dock' property for any control you should never have to set the '.Top'/'.Left' properties, the '.Width'/'.Height' properties should not be used if '.Dock = Fill'. If you set these properties after you set the '.Dock' properties you will receive undesirable results. with '$Panel_dock = 3,"",5' the second panel created is not docked at all and should be docked to the bottom '2'. also i think that part of what is happening is that the controls are not created in a sequence that is indicative of what you are trying to achieve. '.Dock' property its self alows a form or container to be resized and the '.Width'/'.Height' properties will automaticly change to sute the size of the container. maybe i did not say things very well but these are the things that i was trying to show you in this post: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=170867&page=1#Post171243 |
||||||||
|
|
|||||||
When I Dock the second panel as you suggest and remove all entries of Top/Left/Width/Height it is all messed up. It may be do to the creation as you suggest. I will try it by not using the Panel Array. (But control arrays are so nice to use, makes it easy to add and remove them). |
||||||||
|
|
|||||||
I think you hit the nail on the head, for the creation of this form, the sequence should be: TopPanel for TopListView .dock = fill TopListView inside TopPanel .dock = fill ComboBox for TopListView inside TopPanel .dock = top Splitter .dock = bottom BottomPanel for BottomListView .dock = bottom BottomListView inside BottomPanel .dock = fill BottomLabel for BottomListView inside BottomPanel .dock = top ButtonPanel for Buttons .dock = left Buttons inside ButtonPanel .dock = top Buttons created starting with last button first to accommodate the .dock property if you create the panels one after the other then create the splitter the .dock sequence is messed up. |
||||||||
|
|
|||||||
So with that said (and I have not done it yet), what is the proper method for determining the correct build pattern. Also I see that you have the the TopPanel fill the entire form, where my idea had been to put the ButtonPanel in first, and then build the other panels around it (obviously wrong). |
||||||||
|
|
|||||||
Gargoyle, As far as determining the correct build pattern, for me I use kfd to create the basic structure and then use the Object TreeView to rearrange the sequence until I have the layout I am looking for. As you create more forms that use the .Dock property you will begin to see a pattern. That pattern tends to be, create controls backward to what you would think they should be created. You will also notice that typically the control that needs to be set to fill, is the first one created. I don't know that any particular way of doing things is right or wrong as long as it gets you to the result you need. |
||||||||
|
|
|||||||
I think I know what was really killing me now.... When placing the controls in KFD, I would set the dock property and when set to fill, you cannot add another control to that panel (because it is already "filled"). Once you have all of your elements placed within the parent, then decide how they need to be arranged, and move them around. Just a different way of working the problem than what I came up with. |
||||||||
|
|
|||||||
I Think that just about everyone that is going to post has, except maybe Jochen. Here is my solution: Code: ;Things to Note: ;Comments, they are in every part of the form and it's construction, it makes it easier for others to ; understand what is happening and what controls are used for. ;Variable names are descriptive and easy to keep straight as you dig into the code. ;I use '$MainForm.Tag' to store the original 'Form.Size' for easy retrieval in the 'MainForm.SizeChanged' ; event function. Most controls have a '.Tag' property, it is very useful for many things. ; The '.Tag' property can be used to store just about anything including arrays and even ; multi-dimensional arrays. ;Personal preference, when creating a stack of controls that are identical: ; create an array that contains a list of names or '.Text' values to identify the different controls, ; then loop thru their construction with a 'For Next' loop. This way you don't have a huge list of identical ; controls that would be difficult for anyone to keep straight. ;region Set Code Options ;Set Break to On if not in Logon Mode. If Not @LogonMode Break On EndIf ;Set Code Options to On Dim $SO $SO=SetOption("NoMacrosInStrings", "ON") $SO=SetOption("NoVarsInStrings", "ON") $SO=SetOption("Explicit", "ON") ;endregion Set Code Options ;region Setup Varibles ;Dim variables in order of creation. Global $System,$MainForm Dim $nul,$ImageList,$MainMenu,$FileMenuItem,$ExitMenuItem,$MainPanel, $DeletePanel,$DeleteListView,$DeleteListViewColumn0,$DeleteListViewColumn1,$DeleteLabel, $Splitter, $ActivePanel,$ActiveListView,$ActiveListViewColumn0,$ActiveListViewColumn1,$ActiveComboBox, $ControlPanel,$ControlButton,$Controls,$Control,$ImageIndex ;Create an array of names of the 'Control Stack'. $Controls = "Exit","Delete","Refresh","Restore","Backup","Save" ;Create 'Kixforms.System' Object. $System = CreateObject("Kixforms.System") ;Verify the 'Kixforms.System' Object was created if not, notify and exit. If Not $System $nul= MessageBox("KiXforms.Net Not Initiated."+@CRLF+ "Please verify KiXforms.Net is installed."+@CRLF+ "This Script Will Now Close.","Error",16) Quit() EndIf ;Create an 'ImageList' for the 'Control Stack'. $ImageList = $System.ImageList() $ImageList.ImageSize = $System.Size(16,16) $nul = $ImageList.Images.AddStrip(ControlImages()) ;endregion Setup Varibles ;region Main Form ;Create Form and Controls. ;Store the original 'MainForm.Size' in 'MainForm.Tag' for easy retrieval in the 'MainForm.SizeChanged' event function. $MainForm = $System.Form() $MainForm.Font = $System.Font("Verdana",8.25,0) ;Regular $MainForm.Icon = $System.Icon.FromBitmap(FormIcon()) $MainForm.StartPosition = $System.FormStartPosition_CenterScreen $MainForm.Size = $System.Size(600,400) ;(Width,Height) $MainForm.SizeChanged = "OnFormSizeChange()" $MainForm.Text = "Windows Registry Run [Project 01 - Lession 01]" $MainForm.Tag = $System.Size(600,400) ;(Width,Height) ;Create the MainMenu. $MainMenu = $System.MainMenu() $FileMenuItem = $MainMenu.MenuItems.Add($System.MenuItem("File")) $ExitMenuItem = $FileMenuItem.MenuItems.Add($System.MenuItem("Exit")) $ExitMenuItem.Click = "ExitForm()" $MainForm.Menu = $MainMenu ;region Form Controls ;Most controls are attached to the MainPanel. $MainPanel = $System.Panel() $MainPanel.Dock = $System.DockStyle_Fill $nul = $MainForm.Controls.Add($MainPanel) ;region Active Panel ;Create the upper Panel, it contains the controls above the spliter. $ActivePanel = $System.Panel() $ActivePanel.BorderStyle = $System.BorderStyle_Fixed3D $ActivePanel.Dock = $System.DockStyle_Fill $ActivePanel.Height = 160 $nul = $MainPanel.Controls.Add($ActivePanel) ;Create the upper ListView, to display the current registry entries. $ActiveListView = $System.ListView() $ActiveListView.CheckBoxes = "True" $ActiveListView.Dock = $System.DockStyle_Fill $ActiveListView.FullRowSelect = "True" $ActiveListView.GridLines = "True" $ActiveListView.View = $System.View_Details $nul = $ActivePanel.Controls.Add($ActiveListView) ;Create the Columns for the upper ListView. $ActiveListViewColumn0 = $ActiveListView.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left)) $ActiveListViewColumn1 = $ActiveListView.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Left)) ;Create a ComboBox for the upper ListView to tell the user what registry key the user is viewing. $ActiveComboBox = $System.ComboBox() $ActiveComboBox.Dock = $System.DockStyle_Top $nul = $ActivePanel.Controls.Add($ActiveComboBox) ;endregion Active Panel ;Create a horizontal Splitter so the user can adjust the vertical size of the ListViews. $Splitter = $System.Splitter() $Splitter.BackColor = $System.Color.FromName("ActiveCaption") $Splitter.Dock = $System.DockStyle_Bottom $Splitter.Height = 3 $nul = $MainPanel.Controls.Add($Splitter) ;region Delete Panel ;Create the lower Panel, it contains the controls below the spliter. $DeletePanel = $System.Panel() $DeletePanel.BorderStyle = $System.BorderStyle_Fixed3D $DeletePanel.Dock = $System.DockStyle_Bottom $DeletePanel.Height = 150 $nul = $MainPanel.Controls.Add($DeletePanel) ;Create the lower ListView, to display the registry entries to be deleted. $DeleteListView = $System.ListView() $DeleteListView.Dock = $System.DockStyle_Fill $DeleteListView.FullRowSelect = "True" $DeleteListView.GridLines = "True" $DeleteListView.View = $System.View_Details $nul = $DeletePanel.Controls.Add($DeleteListView) ;Create the Columns for the lower ListView. $DeleteListViewColumn0 = $DeleteListView.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left)) $DeleteListViewColumn1 = $DeleteListView.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Left)) ;Create a Lable for the lower ListView to tell the user what the lower ListView is for. $DeleteLabel = $System.Label() $DeleteLabel.Dock = $System.DockStyle_Top $DeleteLabel.Height = 20 $DeleteLabel.Text = "Entries to Delete" $DeleteLabel.TextAlign = $System.ContentAlignment_MiddleCenter $nul = $DeletePanel.Controls.Add($DeleteLabel) ;endregion Delete Panel ;region User Controls ;Create a Panel for the form user controls. $ControlPanel = $System.Panel() $ControlPanel.BorderStyle = $System.BorderStyle_Fixed3D $ControlPanel.Dock = $System.DockStyle_Left $ControlPanel.Width = 90 $nul = $MainForm.Controls.Add($ControlPanel) ;Create the user controls: Exit, Delete, Refresh, Restore, Backup, Save. $ImageIndex = 0 For Each $Control in $Controls $ControlButton = $System.Button() $ControlButton.Dock = $System.DockStyle_Top $ControlButton.Height = 26 $ControlButton.ImageAlign = $System.ContentAlignment_TopLeft $ControlButton.ImageList = $ImageList $ControlButton.ImageIndex = $ImageIndex $ControlButton.Text = $Control $ControlButton.TextAlign = $System.ContentAlignment_MiddleRight $nul = $ControlPanel.Controls.Add($ControlButton) $ImageIndex = $ImageIndex + 1 Next ;endregion User Controls ;endregion Form Controls ;region Startup ;endregion Startup ;Show the Form $MainForm.Show ;Loop to catch form events. While $MainForm.Visible $nul = Execute($MainForm.DoEvents()) Loop Exit 0 ;endregion Main Form ;region Main Form Functions ;The 'OnFormSizeChange()' function adjusts the size of the form to the minimum size ;if the user tries to Set it too Small. Function OnFormSizeChange() Dim $MainForm_Size ;Retrieve the original 'MainForm.Size' from 'MainForm.Tag' $MainForm_Size = $MainForm.Tag If $MainForm.Width < $MainForm_Size.Width And Not($MainForm.WindowState = 1) $MainForm.Width = $MainForm_Size.Width EndIf If $MainForm.Height < $MainForm_Size.Height And Not($MainForm.WindowState = 1) $MainForm.Height = $MainForm_Size.Height EndIf EndFunction ;The 'ExitForm()' function exits the form. Function ExitForm() Quit 0 EndFunction ;endregion Main Form Functions ;region Images ;The 'FormIcon()' function creates the icon for 'MainForm.Icon'. Function FormIcon() $FormIcon = " Qk02BAAAAAAAADYAAAAoAAAAEAAAABAAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA AP8AAAD/AAAA/wAAAP/////////////////////////////////////////////////AwMD/ wMDA/8DAwP///////////wAAAP8AAAD/////////////////////////////////wMDA/8DA wP8AAAD/AAAA/wAAAP/AwMD///////////8AAAD/AAAA//////////////////////////// AAAA/wAAAP8AAAD/AAAA/wAA//8AAAD/wMDA////////////AAAA/wAAAP////////////// /////////////wAAAP/AwMD//////wAAAP8AAAD/AAAA/////////////////wAAAP8AAAD/ //////////////////////////8AAAD/wMDA////////////wMDA/8DAwP/AwMD///////// //8AAAD/AAAA////////////////////////////AAAA/8DAwP/AwMD/AAAA/wAAAP8AAAD/ wMDA////////////AAAA/wAAAP///////////////////////////wAAAP8AAAD/AAAA/wAA AP8A/wD/AAAA/8DAwP///////////wAAAP8AAAD///////////////////////////8AAAD/ wMDA/8DAwP8AAAD/AAAA/wAAAP////////////////8AAAD//////8DAwP/AwMD/wMDA/8DA wP8AAAD/AAAA/wAAAP/AwMD/////////////////////////////////AAAA//////8AAAD/ AAAA/wAAAP8AAAD/AAAA/wD///8AAAD/wMDA/////////////////////////////////wAA AP//////AAAA/8DAwP///////////wAAAP8AAAD/AAAA//////////////////////////// //////////8AAAD//////wAAAP/AwMD///////////////////////////////////////// ////////////////////////AAAA/wAAAP8AAAD/AAAA/8DAwP8AAP//AAD//wAA//8AAP// AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAAAP8AAAD///8A/wAAAP/AwMD/AAD//wAA //8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAAD/AAAA/wAAAP8AAAD/ wMDA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/w== " $FormIcon = $System.Bitmap.FromBase64String($FormIcon) EndFunction ;The 'ControlImages()' function creates the images for the 'ImageList'. Function ControlImages() $ControlImages = " iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAYAAADpunr5AAAAAXNSR0IArs4c6QAAAARnQU1B AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA AAlwSFlzAAAOwgAADsIBFShKgAAABrxJREFUWEftWFlMFVcYnhdfjGl86lObtEnjg3bBmnQx GknsEmto1MZWa1uxVWPVGFvAWo2Cqdq6VGsTFKoV6gKiVjCX7bIvF/CCisLVy+KFsl028SJL RVC+/v/MPcPcYYbFJe1DJ/lyhzPnnG/O9/3n/88gSf9f/w0Ffkltw49xt0bF7phKPI03/rf5 n8aaxjXnAUsjBgcHYXTdfwB03VcQ9mcjfogq8zHh4esSBmdI4N9xkWo6Pw6/D+eMSDzzbgwm zIqGRPeG78PtZs/0A0Rf7a+uT8huK/z9Y9Dd3T0qrNYyLF2ajYAA3bv9nFCHgYGBYfqz+H3U 7LmnYFkq8PXJOmw/Uqwu7gEJr8WjmPA4/DKfV6AvznXhk2RgSgwwcc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FBkRESUyIiMvIyjIisDA wuHH0G37rKhraJJzvrtyKAU1RRxUd0JFVBTSXEByNbDiy18NBa17RYJAveb+L7pnmJkg+IXw ovgG2ZS0x8JPP+cP6y0TfhaExWMIcfhXK6b+XttPb5T4m873PvOxgSSg/hS0mtoZK1fasGVL IUJDS7B1axHWrUuhdgsJn40lS1JIeIuxAVt/SkJNXYO87WvptMNRf2+xn7x414kouIMC5chj 8S1VwPLAg8PErHlZghZasc3aRR89vzBgSqwfVmWFYdLxyXIdMOVnMVkskefH+qE1Wm4Uz3k+ inK1AGvGcQoSBvAHlt3uUpGaaoPVmg+n04UZNAfD8ENs844LcFbVoLoDqKDTzjXvaUfkfBH5 8U7g/E36IPt8v2rAjWkSnBpU0r3RuqrJoCqC0XMtv7Md4MjXnn4WJG+UxTfiV7nELmAT3jP4 sBqr2Pp+PK84for6MKIBDZg//yKCg2Pl05DL5UJ/f/8oBoSeh6PSJYtf3qoUPW3OF5HH4p8p JwOW7VNFdpDgAmzGSOusoOcC2n6bvfw3SXzm54LLWJ4Rhk22KFn8hArFfD2/Dx8LxGlImPCo omsjf/ZJww8wbRHW7gCL5QoWLUqlmpCiit/Z2TmyASFbYnHVUTli5J+7AZy8DkRfA5Z+utdH 6OtTJTDGst5y6lfmhbqIx+T34eWI1f6rYSwvZdZHnKDYBJO0pk9B4eEn5GJssymRz+LX1NSM YsDm00jNakZKhkdB+h0kp3Ug2XobSantSEppQ2JyKxKTWmBJbB5mwHjXqDcs5EnzP8kaIEww WaTegLi4OJ/Id7vdVAOchgb8AzONw4G+paf3AAAAAElFTkSuQmCC" $ControlImages = $System.Bitmap.FromBase64String($ControlImages) EndFunction ;endregion Images I will now post Lesson 02. Next Lesson: Project 01 - Lesson 02 You may use my solution, someone else's or modify your own to include bits and pieces of different ones. |