JellyFish666 Posted February 10, 2008 Posted February 10, 2008 (edited) Hello I just signed up for autoit today, I have been using autoit for 3-4 days now and I am amazed at how easy it is to learn from. I have a little problem though, the project I have been working on is turning out better than I expected except for a little problem with a Edit Control that is used for my text box. I have the text box aligned to the left (the text will be typed to the left) but the user has an option to change it to center and right as well. I had it working on my computer but when I sent it to a friend who was interested in the project he said it didn't work that it did nothing and than I tried it on my other computer which is also running "Windows XP" and it also did nothing and than I got confused because all of the computers are running WINXP except my main computer is running service pack 3 and has many things installed that may be affecting it. This code worked on my main computer but not on my friends or my other computer. Func _Align($AlignNum) If $AlignNum = 1 Then $Align = $ES_LEFT ElseIf $AlignNum = 2 Then $Align = $ES_CENTER Else $Align = $ES_RIGHT EndIf GUICtrlSetStyle($Text , $Align + $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_WANTRETURN , $WS_EX_ACCEPTFILES) EndFuncoÝ÷ ئlº·°(v¬ÂänërzØv¬m!©Ê0¢w^®)à¢gq©÷ö×kj^Æ×âë(Ú-ë^ÆÖèÅ«¢+ÙU% ÑɱMÑMÑÑ ÀÌØíU%}I=A AQ°´Ä¤ Edited February 10, 2008 by JellyFish666
picaxe Posted February 10, 2008 Posted February 10, 2008 Try these Func _Align($AlignNum) If $AlignNum = 1 Then $Align = $ES_LEFT ElseIf $AlignNum = 2 Then $Align = $ES_CENTER Else $Align = $ES_RIGHT EndIf GUICtrlSetStyle($Text , BitOR(Hex($Align), $ES_AUTOVSCROLL, $WS_VSCROLL, $ES_WANTRETURN) , $WS_EX_ACCEPTFILES) EndFuncoÝ÷ Ù«¢+ÙU% ÑɱMÑMÑÑ ´Ä°ÀÌØíU%}I=A AQ¤
JellyFish666 Posted February 10, 2008 Author Posted February 10, 2008 (edited) Thanks for trying to help me I have tried what you said to do and they both didn't work. I also tried this but for some reason it won't work. The funniest thing is it works on my computer but not other computers. #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 180 , Default , $WS_EX_ACCEPTFILES) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $Left = GUICtrlCreateButton("Left" , 0 , 180 , 75 , 20) $Center = GUICtrlCreateButton("Center" , 80 , 180 , 75 , 20) $Right = GUICtrlCreateButton("Right" , 160 , 180 , 75 , 20) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left GUICtrlSetStyle($Edit1 , $ES_LEFT) Case $msg = $Center GUICtrlSetStyle($Edit1 , $ES_CENTER) Case $msg = $Right GUICtrlSetStyle($Edit1 , $ES_RIGHT) EndSelect WEnd Edited February 10, 2008 by JellyFish666
JellyFish666 Posted February 10, 2008 Author Posted February 10, 2008 (edited) I think that GUICtrlSetStyle() can not update like GUICtrlSetState() which is weird because just say I have a script that uses checkboxes GUICtrlSetState() updates them to "checked" or "unchecked" but GUICtrlSetStyle() will not edit my "text control" I think there is a problem with the forum I can't edit my last topic but I can edit this one Edited February 10, 2008 by JellyFish666
picaxe Posted February 10, 2008 Posted February 10, 2008 (edited) Thanks for trying to help me I have tried what you said to do and they both didn't work. I also tried this but for some reason it won't work. The funniest thing is it works on my computer but not other computers. #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 180 , Default , $WS_EX_ACCEPTFILES) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $Left = GUICtrlCreateButton("Left" , 0 , 180 , 75 , 20) $Center = GUICtrlCreateButton("Center" , 80 , 180 , 75 , 20) $Right = GUICtrlCreateButton("Right" , 160 , 180 , 75 , 20) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left GUICtrlSetStyle($Edit1 , $ES_LEFT) Case $msg = $Center GUICtrlSetStyle($Edit1 , $ES_CENTER) Case $msg = $Right GUICtrlSetStyle($Edit1 , $ES_RIGHT) EndSelect WEndNo probs, your example works OK on my computer (WinXp SP2) via Scitie and compiled. I'm using AutoIt v3.2.10.0 Are you running compiled versions on the other computers. If not what version of AutoIt is installed there. Edited February 10, 2008 by picaxe
JellyFish666 Posted February 11, 2008 Author Posted February 11, 2008 (edited) This is really starting to frustrate me it works on my computer but not on my other one and I am not sure why I can't drag text files on the edit control and make it put the data into the control. I am running the newest on my computer and a bit older one on my other computer but when I compiled it from my computer (the computer which is working) and sent it to a friend it didn't work. Please can someone tell me what I am doing incorrectly and Thanks a lot for helping Picaxe Edited February 11, 2008 by JellyFish666
Ealric Posted February 11, 2008 Posted February 11, 2008 (edited) This is really starting to frustrate me it works on my computer but not on my other one and I am not sure why I can't drag text files on the edit control and make it put the data into the control. I am running the newest on my computer and a bit older one on my other computer but when I compiled it from my computer (the computer which is working) and sent it to a friend it didn't work. Please can someone tell me what I am doing incorrectly and Thanks a lot for helping Picaxe Here, this will fix the issue you are having: #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200,-1,-1,-1,$WS_EX_ACCEPTFILES) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 180) GUICtrlSetState($Edit1, $GUI_DROPACCEPTED) $Left = GUICtrlCreateButton("Left" , 0 , 180 , 75 , 20) $Center = GUICtrlCreateButton("Center" , 80 , 180 , 75 , 20) $Right = GUICtrlCreateButton("Right" , 160 , 180 , 75 , 20) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left GUICtrlSetStyle($Edit1 , $ES_LEFT) Case $msg = $Center GUICtrlSetStyle($Edit1 , $ES_CENTER) Case $msg = $Right GUICtrlSetStyle($Edit1 , $ES_RIGHT) EndSelect WEnd Also, if I'm not mistaken edit controls when you use drop accepted, only accept the file names. Again, I could be mistaken but I believe that's what happens. Edited February 11, 2008 by Ealric My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]
JellyFish666 Posted February 11, 2008 Author Posted February 11, 2008 (edited) Here, this will fix the issue you are having: #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200,-1,-1,-1,$WS_EX_ACCEPTFILES) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 180) GUICtrlSetState($Edit1, $GUI_DROPACCEPTED) $Left = GUICtrlCreateButton("Left" , 0 , 180 , 75 , 20) $Center = GUICtrlCreateButton("Center" , 80 , 180 , 75 , 20) $Right = GUICtrlCreateButton("Right" , 160 , 180 , 75 , 20) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left GUICtrlSetStyle($Edit1 , $ES_LEFT) Case $msg = $Center GUICtrlSetStyle($Edit1 , $ES_CENTER) Case $msg = $Right GUICtrlSetStyle($Edit1 , $ES_RIGHT) EndSelect WEnd Also, if I'm not mistaken edit controls when you use drop accepted, only accept the file names. Again, I could be mistaken but I believe that's what happens. Thanks that works I am not sure but if I can tell when they drag a file I could FileRead() and GuiCtrlSetData() and than once that is done all I need to do is fix my Align function. I don't get why my Align function works on my computer but not others do I have files that are required in order to use that function that other people may not have I don't think it would require much to run the simple command for a edit control I am sure most windows would come with something like that. Edited February 11, 2008 by JellyFish666
picaxe Posted February 11, 2008 Posted February 11, 2008 I didn't check that drop files works. It looks like ex-style $WS_EX_ACCEPTFILES should be set on the form and not the edit control. This works (maybe this will now work on your other computers) #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 180) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) $Left = GUICtrlCreateButton("Left", 0, 180, 75, 20) $Center = GUICtrlCreateButton("Center", 80, 180, 75, 20) $Right = GUICtrlCreateButton("Right", 160, 180, 75, 20) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left GUICtrlSetStyle($Edit1, $ES_LEFT) Case $msg = $Center GUICtrlSetStyle($Edit1, $ES_CENTER) Case $msg = $Right GUICtrlSetStyle($Edit1, $ES_RIGHT) EndSelect WEnd
JellyFish666 Posted February 11, 2008 Author Posted February 11, 2008 I didn't check that drop files works. It looks like ex-style $WS_EX_ACCEPTFILES should be set on the form and not the edit control. This works (maybe this will now work on your other computers) #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 180) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) $Left = GUICtrlCreateButton("Left", 0, 180, 75, 20) $Center = GUICtrlCreateButton("Center", 80, 180, 75, 20) $Right = GUICtrlCreateButton("Right", 160, 180, 75, 20) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left GUICtrlSetStyle($Edit1, $ES_LEFT) Case $msg = $Center GUICtrlSetStyle($Edit1, $ES_CENTER) Case $msg = $Right GUICtrlSetStyle($Edit1, $ES_RIGHT) EndSelect WEnd yep thanks it does now I just need a way to tell if files are being dropped on to the edit control and I need to fix align.
Ealric Posted February 11, 2008 Posted February 11, 2008 (edited) yep thanks it does now I just need a way to tell if files are being dropped on to the edit control and I need to fix align. Jelly, use this and it will do everything you need. It's a bit more flexible too: expandcollapse popup#include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200,-1,-1,-1,$WS_EX_ACCEPTFILES) Global $Edit1 = ObjCreate("RICHTEXT.RichTextCtrl") $GUIActiveX = GUICtrlCreateObj($Edit1, 0,0) With $Edit1 .OLEObjects () .OLEDrag () .OLEDropMode = 2 .ScrollBars () .AutoVerbMenu = 1 .MultiLine () .SelStart = 0 .SelFontName = "Arial" .SelFontSize = 9 .HideSelection = False .BackColor = 0xFFFFFF EndWith GUICtrlSetPos($GUIActiveX, 0, 0, 300, 180) GUICtrlSetResizing($GUIActiveX, $GUI_DOCKBORDERS) $Left = GUICtrlCreateButton("Left" , 0 , 180 , 75 , 20) $Center = GUICtrlCreateButton("Center" , 80 , 180 , 75 , 20) $Right = GUICtrlCreateButton("Right" , 160 , 180 , 75 , 20) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left $Edit1.SelAlignment = 0 ;rtfLeft Case $msg = $Center $Edit1.SelAlignment = 2 ;rtfCenter Case $msg = $Right $Edit1.SelAlignment = 1 ;rtfRight EndSelect WEnd Edited February 11, 2008 by Ealric My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]
JellyFish666 Posted February 11, 2008 Author Posted February 11, 2008 Jelly, use this and it will do everything you need. It's a bit more flexible too: expandcollapse popup#include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200,-1,-1,-1,$WS_EX_ACCEPTFILES) Global $Edit1 = ObjCreate("RICHTEXT.RichTextCtrl") $GUIActiveX = GUICtrlCreateObj($Edit1, 0,0) With $Edit1 .OLEObjects () .OLEDrag () .OLEDropMode = 2 .ScrollBars () .AutoVerbMenu = 1 .MultiLine () .SelStart = 0 .SelFontName = "Arial" .SelFontSize = 9 .HideSelection = False .BackColor = 0xFFFFFF EndWith GUICtrlSetPos($GUIActiveX, 0, 0, 300, 180) GUICtrlSetResizing($GUIActiveX, $GUI_DOCKBORDERS) $Left = GUICtrlCreateButton("Left" , 0 , 180 , 75 , 20) $Center = GUICtrlCreateButton("Center" , 80 , 180 , 75 , 20) $Right = GUICtrlCreateButton("Right" , 160 , 180 , 75 , 20) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left $Edit1.SelAlignment = 0 ;rtfLeft Case $msg = $Center $Edit1.SelAlignment = 2 ;rtfCenter Case $msg = $Right $Edit1.SelAlignment = 1 ;rtfRight EndSelect WEnd Thanks it works perfect but I have been trying to avoid that and so far I have been doing good there must be another way, because I would have to rewrite my script and other stuff and I don't like the sounds of creating objects because it requires extra files.
Ealric Posted February 11, 2008 Posted February 11, 2008 What is below should work because by default the edit control is forced to multiline. In order to make it appear better, I combined the default style with the added style. However, I have not been able to test this. Let me know if it works. If it doesn't, we'll work from this together and figure out why. #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 180) GUICtrlSetState($Edit1, $GUI_DROPACCEPTED) GUISetState() $Left = GUICtrlCreateButton("Left", 0, 180, 75, 20) $Center = GUICtrlCreateButton("Center", 80, 180, 75, 20) $Right = GUICtrlCreateButton("Right", 160, 180, 75, 20) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left GUICtrlSetStyle($Edit1,BitOr($GUI_SS_DEFAULT_EDIT,$ES_LEFT)) Case $msg = $Center GUICtrlSetStyle($Edit1,BitOr($GUI_SS_DEFAULT_EDIT,$ES_CENTER)) Case $msg = $Right GUICtrlSetStyle($Edit1,BitOr($GUI_SS_DEFAULT_EDIT,$ES_RIGHT)) EndSelect WEnd My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]
JellyFish666 Posted February 11, 2008 Author Posted February 11, 2008 What is below should work because by default the edit control is forced to multiline. In order to make it appear better, I combined the default style with the added style. However, I have not been able to test this. Let me know if it works. If it doesn't, we'll work from this together and figure out why. #include <GUIConstants.au3> $Form1 = GUICreate("AForm1", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) $Edit1 = GUICtrlCreateEdit("", 0, 0, 300, 180) GUICtrlSetState($Edit1, $GUI_DROPACCEPTED) GUISetState() $Left = GUICtrlCreateButton("Left", 0, 180, 75, 20) $Center = GUICtrlCreateButton("Center", 80, 180, 75, 20) $Right = GUICtrlCreateButton("Right", 160, 180, 75, 20) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Left GUICtrlSetStyle($Edit1,BitOr($GUI_SS_DEFAULT_EDIT,$ES_LEFT)) Case $msg = $Center GUICtrlSetStyle($Edit1,BitOr($GUI_SS_DEFAULT_EDIT,$ES_CENTER)) Case $msg = $Right GUICtrlSetStyle($Edit1,BitOr($GUI_SS_DEFAULT_EDIT,$ES_RIGHT)) EndSelect WEnd Yep this works on my computer but I can't test to see if it works on my other computer since it's not here, ill message my friend and see if it works for him when I see him online. Thanks to the both of you ill let you know how things worked out and if others can test it and tell us if it worked that would be great.
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