NerdFencer Posted July 9, 2008 Share Posted July 9, 2008 I am writing a tabbed text editor, and I have several problems. The first is that whenever the window is moved out from under another window, or from off the edge of the screen, the tab control behind the edit box shows through (this also happens briefly during the resizing of the window). My other problem is that for some reason, the drag and drop file function doesn't work. Specifically, when I drag a file onto the edit control, the name of the file flashes in the edit box, but the text of the file never appears. Here is the script so far: expandcollapse popupNoTrayIcon InitialiseGlobalConstants() ;Initialise GUI $GUI=GUICreate("Type",640,480,-1,-1,BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX,$WS_CAPTION, $WS_POPUP, $WS_SIZEBOX,$WS_EX_COMPOSITED),$WS_EX_ACCEPTFILES) InitialiseTabs() GUISetState(@SW_SHOW) ;Main Loop While 1 $msg=GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED GUICtrlSetData(@GUI_DropID,FileRead(@GUI_DragFile)) EndSwitch Sleep(2) WEnd Func InitialiseGlobalConstants() Global Const $GUI_EVENT_CLOSE = -3 Global Const $GUI_EVENT_DROPPED = -13 Global Const $WS_MAXIMIZEBOX = 0x00010000 Global Const $WS_MINIMIZEBOX = 0x00020000 Global Const $WS_CAPTION = 0x00C00000 Global Const $WS_POPUP = 0x80000000 Global Const $WS_SIZEBOX = 0x00040000 Global Const $WS_EX_COMPOSITED = 0x2000000 Global Const $GUI_DOCKBORDERS = 0x0066 Global Const $ES_WANTRETURN = 4096 Global Const $ES_MULTILINE = 4 Global Const $ES_AUTOVSCROLL = 64 Global Const $ES_AUTOHSCROLL = 128 Global Const $WS_EX_ACCEPTFILES = 0x00000010 Global Const $GUI_DROPACCEPTED = 8 EndFunc Func InitialiseTabs() Local $avTampArray=WinGetClientSize ( "Type" ) Global $TABS=GUICtrlCreateTab(0,0,$avTampArray[0],$avTampArray[1]) Global $TAB[1]=[GUICtrlCreateTabItem( "Untitled" )] GUICtrlSetResizing(-1,$GUI_DOCKBORDERS) GUICtrlSetBkColor(-1,0xFFFFFF) Global $EDIT[1]=[GUICtrlCreateEdit("",1,20,640,480,BitOR($ES_WANTRETURN,$ES_MULTILINE,$ES_AUTOVSCROLL,$ES_AUTOHSCROLL),$WS_EX_ACCEPTFILES)] GUICtrlSetResizing(-1,$GUI_DOCKBORDERS) GUICtrlSetState(-1,$GUI_DROPACCEPTED) EndFunc _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
goldenix Posted July 9, 2008 Share Posted July 9, 2008 Case $GUI_EVENT_DROPPED GUICtrlSetData(@GUI_DropID,@GUI_DragFile) My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
NerdFencer Posted July 9, 2008 Author Share Posted July 9, 2008 Case $GUI_EVENT_DROPPED GUICtrlSetData(@GUI_DropID,@GUI_DragFile) Changed, and still doesn't work Case $GUI_EVENT_DROPPED GUICtrlSetData(@GUI_DropID,FileRead(@GUI_DragFile)) _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
goldenix Posted July 9, 2008 Share Posted July 9, 2008 (edited) Worked for me, but Hire is an udf you can look at. & _GUICtrlEdit_AppendText #412438 Edited July 9, 2008 by goldenix My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
NerdFencer Posted July 9, 2008 Author Share Posted July 9, 2008 That is a nice udf, but it isnt what I need. Here is the latest code including your fix, but it still doesn't work, can you take another look? expandcollapse popup#NoTrayIcon InitialiseGlobalConstants() ;Initialise GUI $GUI=GUICreate("Type",640,480,-1,-1,BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX,$WS_CAPTION, $WS_POPUP, $WS_SIZEBOX,$WS_EX_COMPOSITED),$WS_EX_ACCEPTFILES) InitialiseMenu() InitialiseTabs() GUISetState(@SW_SHOW) ;Main Loop While 1 $msg=GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $M_File_New For $index=0 To 24 If Not($USEDTAB[$index]) Then $USEDTAB[$index]=1 $TAB[$index]=GUICtrlCreateTabItem( "Untitled" ) GUICtrlSetResizing(-1,$GUI_DOCKBORDERS) $EDIT[$index]=GUICtrlCreateEdit("",1,20,640,460,BitOR($ES_WANTRETURN,$ES_MULTILINE,$ES_AUTOVSCROLL,$ES_AUTOHSCROLL),$WS_EX_ACCEPTFILES) GUICtrlSetResizing(-1,$GUI_DOCKBORDERS) GUICtrlSetState(-1,$GUI_DROPACCEPTED) ExitLoop EndIf Next Case $M_File_Close Case $GUI_EVENT_DROPPED GUICtrlSetData(@GUI_DropID,FileRead(@GUI_DragFile)) EndSwitch Sleep(2) WEnd Func InitialiseMenu() Global $M_File=GUICtrlCreateMenu("File") Global $M_File_New=GUICtrlCreateMenuItem("New",$M_File) Global $M_File_Close=GUICtrlCreateMenuItem("Close",$M_File) EndFunc Func InitialiseGlobalConstants() ;GUI Events Global Const $GUI_EVENT_CLOSE = -3 Global Const $GUI_EVENT_DROPPED = -13 ;GUI STYLES Global Const $WS_MAXIMIZEBOX = 0x00010000 Global Const $WS_MINIMIZEBOX = 0x00020000 Global Const $WS_CAPTION = 0x00C00000 Global Const $WS_POPUP = 0x80000000 Global Const $WS_SIZEBOX = 0x00040000 Global Const $WS_EX_COMPOSITED = 0x2000000 ;GUI CTRL STYLES Global Const $GUI_DOCKBORDERS = 0x0066 Global Const $ES_WANTRETURN = 4096 Global Const $ES_MULTILINE = 4 Global Const $ES_AUTOVSCROLL = 64 Global Const $ES_AUTOHSCROLL = 128 Global Const $WS_EX_ACCEPTFILES = 0x00000010 Global Const $GUI_DROPACCEPTED = 8 EndFunc Func InitialiseTabs() Local $avTampArray=WinGetClientSize ( "Type" ) Global $TABS=GUICtrlCreateTab(0,0,$avTampArray[0],$avTampArray[1]) GUICtrlSetBkColor(-1,0xFFFFFF) Global $TAB[25]=[GUICtrlCreateTabItem( "Untitled" )] GUICtrlSetResizing(-1,$GUI_DOCKBORDERS) Global $EDIT[25]=[GUICtrlCreateEdit("",1,20,640,460,BitOR($ES_WANTRETURN,$ES_MULTILINE,$ES_AUTOVSCROLL,$ES_AUTOHSCROLL),$WS_EX_ACCEPTFILES)] GUICtrlSetResizing(-1,$GUI_DOCKBORDERS) GUICtrlSetState(-1,$GUI_DROPACCEPTED) Global $USEDTAB[25]=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] EndFunc _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
goldenix Posted July 9, 2008 Share Posted July 9, 2008 thats because you did not change anything. GUICtrlSetData(@GUI_DropID,FileRead(@GUI_DragFile)) to: GUICtrlSetData(@GUI_DropID,@GUI_DragFile) But this aside, Rewrite whole your code using the UDF, is the easiest way. My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
NerdFencer Posted July 9, 2008 Author Share Posted July 9, 2008 all that does it put the path in the box, i want the TEXT of the file in the box _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
goldenix Posted July 9, 2008 Share Posted July 9, 2008 $File = @GUI_DragFile $split = StringSplit($File,'\') $filepath = StringReplace($File,$split[$split[0]],'') ;Replace Filename with nothing to get filepath $Filename = $split[$split[0]] ; $split[$split[0]] is the last split of the stringalso there are other functions like stringtrimright, stringleft etc. check the helpfile My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
NerdFencer Posted July 9, 2008 Author Share Posted July 9, 2008 I fixed the text problem, now I just have the display problem _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
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