magician13134 Posted January 18, 2007 Posted January 18, 2007 (edited) I can code fairly well, and don't need help there, but I'm just having trouble thinking of a way to make this software work. It's just (another) notepad software. What I mainly need help on is the tabs. The tabs aren't permenant, there are only as many as you need, so I have trouble keeping track of their names, because I'm just using an array to name them ($tab[$tab[0]]) with $tab[0] being the amount of open tabs. Then I do _GUICtrlTabGetSel to figure out which tab is selected, but once tabs are deleted, the numbers get off. Also, I want the title to change according to the open tab. There's a vairable that determines whether you can save or if you need to save-as, but once it's set to '1', it let's you save all, not just that tab... yeah, it's confusing, so I'll upload the source and let you guys see if you can work with it. Also, I need help with drag and drop, if you don't mind. There's a comment in the file that goes over this stuff too. Thanks. (If you're going to run this, it'll ask you to make a settings file, just say 'yes' so it doesn't keep asking you) (Instead of making multiple textboxes with the tabs, is there a way to just change the text in it?)NamePad.au3 Edited January 18, 2007 by magician13134 Visit Magic Soft Inc. for some of my software
Danny35d Posted January 19, 2007 Posted January 19, 2007 (edited) ~~~~~~Current Errors~~~~~ 1) Drag and drop, doesn't work at all, I don't know why it shows the filename, I didn't code that... 2) $CanSave needs to be specific to EACH tab 3) Once a tab is deleted (not coded yet) it will throw off the tab names... 4) Would like window title to change to the name of the selected tab... 5) Need to code the context menu for the tabs 6) Probably about 15 more I haven't noticed yet... ~~~~~~Current Errors~~~~~1) Improve new() function remove $tab[] and $TextBox[] 100 limit. 2) Move all global variable to the beging of the script. If you declare a varible global inside of the function, that variable only work for the function it doesn't become global. 3) Improve Open() function now call new() function to create the new tab, also check if file is already open if it is it will set focus to that tab otherwise will open a new tab. 4) $CanSave no needed anymore using FileExist instead. Note: Close() function still need a little work, but it almost there are. Too tired to continue working on the script. Can you elavorate a little more about problem 1 "Drag and drop", every time I used them for guictrlcreateInput or guictrlcreateedit it display the file full path. What are you trying to do? btw nice script... Edit: Wake up this morning and fix Close() function let me know what you think.... Edited January 19, 2007 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
magician13134 Posted January 19, 2007 Author Posted January 19, 2007 1) Improve new() function remove $tab[] and $TextBox[] 100 limit. 2) Move all global variable to the beging of the script. If you declare a varible global inside of the function, that variable only work for the function it doesn't become global. 3) Improve Open() function now call new() function to create the new tab, also check if file is already open if it is it will set focus to that tab otherwise will open a new tab. 4) $CanSave no needed anymore using FileExist instead. Note: Close() function still need a little work, but it almost there are. Too tired to continue working on the script. Can you elavorate a little more about problem 1 "Drag and drop", every time I used them for guictrlcreateInput or guictrlcreateedit it display the file full path. What are you trying to do? btw nice script... Edit: Wake up this morning and fix Close() function let me know what you think.... Wow, thanks. I needed that break... Finally able to get some sleep. Anyway, what you did is very nice, but there's just a few issues still, either you can still help me, or I could try to work them out. Firstly) The tabs dont line up when maximized anymore. 2nd) Now it doesn't accept drag and drop at all. I get a little 'no' circle. It used to put the file's path (which was wierd because I never coded that, it's supposed to make a message box when a file is dropped) 3rd)Closing the tabs is buggy, sometimes it'll ask to save even when not needed and then close entirely instead of just close the tab 4th)when there's only one tab, I'd like exit to close the program entirely. But that's about it, thanks so much! It looks great! Visit Magic Soft Inc. for some of my software
Danny35d Posted January 19, 2007 Posted January 19, 2007 (edited) Firstly) The tabs dont line up when maximized anymore.Delete lines 112 to 116 and replace New() function for this one. Func New($sTitle = 'Untitled') ReDim $tab[UBound($tab) + 1], $tabtitles[UBound($tabtitles) + 1], $TextBox[UBound($TextBox) + 1], $TabSeparate[UBound($TabSeparate) + 1] $tabtitles[UBound($tabtitles) - 1] = $sTitle If $sTitle <> 'Untitled' Then $FileName = StringSplit($file, "\") $sTitle = $FileName[$FileName[0]] EndIf $tab[UBound($tab) - 1] = GUICtrlCreateTabItem($sTitle) $TextBox[UBound($TextBox) - 1] = GUICtrlCreateEdit("", 0, 0, 700, 440, BitOr($WS_VSCROLL, $WS_HSCROLL, $ES_MULTILINE)) GUICtrlSetFont(-1, $FontSize, 400, "", $FontName) GUICtrlSetColor(-1, $FontColor) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetResizing(-1, 102) $TabSeparate[UBound($TabSeparate) - 1] = GUICtrlCreateTabItem("") WinSetTitle($MainWnd, "", $sTitle & " - Namepad by Magic Soft Inc.") $tab[0] = UBound($tab) - 1 $tabtitles[0] = UBound($tabtitles) - 1 $TextBox[0] = UBound($TextBox) - 1 $TabSeparate[0] = UBound($TabSeparate) - 1 EndFunc2nd) Now it doesn't accept drag and drop at all. I get a little 'no' circle. It used to put the file's path (which was wierd because I never coded that, it's supposed to make a message box when a file is dropped)Sorry for testing I forgot I commented out ";, $WS_EX_ACCEPTFILES)" in line 71. Just delete one parentesi and the semi colon. I will try to look at the others issue.4th)when there's only one tab, I'd like exit to close the program entirely.Add this in line 476 If $tab[0] = 0 Then Exit Edited January 19, 2007 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Danny35d Posted January 19, 2007 Posted January 19, 2007 3rd)Closing the tabs is buggy, sometimes it'll ask to save even when not needed and then close entirely instead of just close the tab I will take a look when I get home. Fixed issues 1, 2 and 4. Also now you can drag and drop file and get the context not the file path. Still need a little work at soon I get home I will work on it. AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
magician13134 Posted January 20, 2007 Author Posted January 20, 2007 Ok, thanks! But your solution to #1 didn't work. It needs these two lines in place of 205: $TextBox[uBound($TextBox) - 1] = GUICtrlCreateEdit("", 0, 0, 700, 440, BitOr($WS_VSCROLL, $WS_HSCROLL, $ES_MULTILINE)) GUICtrlSetResizing(-1, 576) Thanks again Visit Magic Soft Inc. for some of my software
Danny35d Posted January 20, 2007 Posted January 20, 2007 Ok, thanks! But your solution to #1 didn't work. It needs these two lines in place of 205: $TextBox[uBound($TextBox) - 1] = GUICtrlCreateEdit("", 0, 0, 700, 440, BitOr($WS_VSCROLL, $WS_HSCROLL, $ES_MULTILINE)) GUICtrlSetResizing(-1, 576) Thanks againYour welcome, those are the same lines I added into New() function on post #4. AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
BrettF Posted January 20, 2007 Posted January 20, 2007 I like Just 1 question.... Does the Word Wrap and Fix Capitalization work??? i really like it Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
BrettF Posted January 20, 2007 Posted January 20, 2007 Maybe in later versions you could have a spell checker. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Danny35d Posted January 20, 2007 Posted January 20, 2007 I don't know if you notice that the enter key won't work, you can type a text and press the enter key, but the cursor won't move to the next line.In the New() function add $ES_WANTRETURN inside of BitOr.$TextBox[uBound($TextBox) - 1] = GUICtrlCreateEdit("", 0, 0, 700, 440, BitOr($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_MULTILINE)) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Danny35d Posted January 21, 2007 Posted January 21, 2007 (edited) Another bug that I found. When you resize the gui and either open or create a new tab it will always create the new tab using the default size. This New() function fix the bug.Func New($sTitle = 'Untitled') Local $GetSize = '', $iWidth = 700, $iHeight = 440 ReDim $drop[UBound($drop) + 1] ReDim $tab[UBound($tab) + 1], $tabtitles[UBound($tabtitles) + 1], $TextBox[UBound($TextBox) + 1], $TabSeparate[UBound($TabSeparate) + 1] $tab[0] = UBound($tab) - 1 $drop[0] = UBound($drop) - 1 $tabtitles[0] = UBound($tabtitles) - 1 $TextBox[0] = UBound($TextBox) - 1 $TabSeparate[0] = UBound($TabSeparate) - 1 $tabtitles[UBound($tabtitles) - 1] = $sTitle If $sTitle <> 'Untitled' Then $FileName = StringSplit($file, "\") $sTitle = $FileName[$FileName[0]] EndIf If $TextBox[0] - 1 > 0 Then $GetSize = ControlGetPos($mainWnd, '', $TextBox[$TextBox[0] - 1]) If IsArray($GetSize) Then $iWidth = $GetSize[2] $iHeight = $GetSize[3] EndIf EndIf $tab[UBound($tab) - 1] = GUICtrlCreateTabItem($sTitle) $TextBox[UBound($TextBox) - 1] = GUICtrlCreateEdit("", 0, 0, $iWidth, $iHeight, BitOr($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_MULTILINE)) GUICtrlSetFont(-1, $FontSize, 400, "", $FontName) GUICtrlSetColor(-1, $FontColor) GUICtrlSetResizing(-1, 102) $drop[UBound($drop) - 1] = GUICtrlCreateInput("", 0, -100, 400, 400, $WS_DISABLED + $ES_AUTOHSCROLL, 0) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $TabSeparate[UBound($TabSeparate) - 1] = GUICtrlCreateTabItem("") WinSetTitle($MainWnd, "", $sTitle & " - Namepad by Magic Soft Inc.") EndFunc Edited January 21, 2007 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
magician13134 Posted January 21, 2007 Author Posted January 21, 2007 (edited) Another bug that I found. When you resize the gui and either open or create a new tab it will always create the new tab using the default size. This New() function fix the bug.Func New($sTitle = 'Untitled') Local $GetSize = '', $iWidth = 700, $iHeight = 440 ReDim $drop[UBound($drop) + 1] ReDim $tab[UBound($tab) + 1], $tabtitles[UBound($tabtitles) + 1], $TextBox[UBound($TextBox) + 1], $TabSeparate[UBound($TabSeparate) + 1] $tab[0] = UBound($tab) - 1 $drop[0] = UBound($drop) - 1 $tabtitles[0] = UBound($tabtitles) - 1 $TextBox[0] = UBound($TextBox) - 1 $TabSeparate[0] = UBound($TabSeparate) - 1 $tabtitles[UBound($tabtitles) - 1] = $sTitle If $sTitle <> 'Untitled' Then $FileName = StringSplit($file, "\") $sTitle = $FileName[$FileName[0]] EndIf If $TextBox[0] - 1 > 0 Then $GetSize = ControlGetPos($mainWnd, '', $TextBox[$TextBox[0] - 1]) If IsArray($GetSize) Then $iWidth = $GetSize[2] $iHeight = $GetSize[3] EndIf EndIf $tab[UBound($tab) - 1] = GUICtrlCreateTabItem($sTitle) $TextBox[UBound($TextBox) - 1] = GUICtrlCreateEdit("", 0, 0, $iWidth, $iHeight, BitOr($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_MULTILINE)) GUICtrlSetFont(-1, $FontSize, 400, "", $FontName) GUICtrlSetColor(-1, $FontColor) GUICtrlSetResizing(-1, 102) $drop[UBound($drop) - 1] = GUICtrlCreateInput("", 0, -100, 400, 400, $WS_DISABLED + $ES_AUTOHSCROLL, 0) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $TabSeparate[UBound($TabSeparate) - 1] = GUICtrlCreateTabItem("") WinSetTitle($MainWnd, "", $sTitle & " - Namepad by Magic Soft Inc.") EndFunc Yeah, I was talking about that earlier, thanks for making a solution. About the $ES_WANTRETURN, I thought I had that in there, I know I did in some earlier version. @Bert, I know cap fix works, but I don't think I've gotten around to word wrap yet. And yes, I'm working on a spell checker now. (It'll allow you to add words to the dictionary too!) Edited January 21, 2007 by magician13134 Visit Magic Soft Inc. for some of my software
BrettF Posted January 21, 2007 Posted January 21, 2007 Yeah, I was talking about that earlier, thanks for making a solution. About the $ES_WANTRETURN, I thought I had that in there, I know I did in some earlier version.@Bert, I know cap fix works, but I don't think I've gotten around to word wrap yet. And yes, I'm working on a spell checker now. (It'll allow you to add words to the dictionary too!)Cool Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now