alawoona Posted April 3, 2004 Share Posted April 3, 2004 JP - I have a suggestion that could perhaps be included in a modified GUIWrite function. I would like to see the ability to move or re-size a conrol previously created by autoit-gui by referring to its controlref parameter. Perhaps you could include the Left, Top, Width and Height as optional parameters in GUIWrite (as you can use GUIWrite to change other properties of a previously created control control). I suggest this as I have some gui's that are somewhat dynamic - controls are added or resized and/or moved according to user input. Of course I can do this using ControlMove, but then I need to know the ClassnameNN of the control (which I can get from using windowspy) or can get using WinGetClassList and then sort through the array of returned control classnames, which can get complicated. Whereas using the controlref parameter created by auto-it would be a much more elegant way of addressing the control and would lead to simpler code for these more complicated gui's. Thanks for all the good work Link to comment Share on other sites More sharing options...
jpm Posted April 3, 2004 Share Posted April 3, 2004 JP - I have a suggestion that could perhaps be included in a modified GUIWrite function. I would like to see the ability to move or re-size a conrol previously created by autoit-gui by referring to its controlref parameter. Perhaps you could include the Left, Top, Width and Height as optional parameters in GUIWrite (as you can use GUIWrite to change other properties of a previously created control control). I suggest this as I have some gui's that are somewhat dynamic - controls are added or resized and/or moved according to user input. Of course I can do this using ControlMove, but then I need to know the ClassnameNN of the control (which I can get from using windowspy) or can get using WinGetClassList and then sort through the array of returned control classnames, which can get complicated. Whereas using the controlref parameter created by auto-it would be a much more elegant way of addressing the control and would lead to simpler code for these more complicated gui's.Thanks for all the good workTHat is putting a lot of parameters to GuiWrite but why not if it is useful.I was thinking this kind of update can be done with the Control...I will think about.Other people please react for a yes or no? Link to comment Share on other sites More sharing options...
Valik Posted April 3, 2004 Share Posted April 3, 2004 (edited) Given that you are not writing to the control, maybe it should be a new function along the lines of GUIControlMove?Remember the old programming addage: A function should only perform one distinct function, and should do it well instead of doing lots of stuff poorly. I'm not saying it does things poorly, I'm saying things are starting to do so much in a single function that it can get confusing.You may also consider moving some things out to seperate functions. GUIWrite can change styles and states and all that...? But that's not writing to the control. See my point? Edited April 3, 2004 by Valik Link to comment Share on other sites More sharing options...
alawoona Posted April 3, 2004 Author Share Posted April 3, 2004 (edited) If it can be done readily then GUIControlMove(controlref, left, top, width, height) would be my preference also. Edited April 3, 2004 by alawoona Link to comment Share on other sites More sharing options...
Josbe Posted April 3, 2004 Share Posted April 3, 2004 Remember the old programming addage: A function should only perform one distinct function, and should do it well instead of doing lots of stuff poorly.If it can be done readily then GUIControlMove(controlref, left, top, width, height) would be my preference also.I agree too. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
jpm Posted April 4, 2004 Share Posted April 4, 2004 I did it by allowing the GuiSetControl to work with controlref so If you don't disagree. GuiWrite will no more set the style/exStyle but you can do it + size/position with GuiSetControl(controlref,"",x,y,w,h,style,exstyle) The text will not be set by this method still stay in the GuiWrite(controlref,state,text) here follow an update of the famous Larry Code with an arrival line Opt("GUICoordMode",1) GUICreate("Race", 350,74,-1,-1) GUISetControl("label", "", 331,0,1,74,5); arrival line $n1=GUISetControl("icon", @windowsdir & "\cursors\horse.ani", 0,0,32,32) $n2=GUISetControl("icon", @windowsdir & "\cursors\horse.ani", 0,40,32,32) GUIShow() Dim $a = 0, $b = 0 While ($a < 300) And ($b < 300) $a = $a + Random(0,2) $b = $b + Random(0,2) GuiSetControl($n1, "",$a,0) GuiSetControl($n2, "",$b,40) Sleep(20) WEnd sleep(1000) Link to comment Share on other sites More sharing options...
alawoona Posted April 4, 2004 Author Share Posted April 4, 2004 JP - I am not sure I understand...in the script above you have 2 forms of GUISetControl The "standard" form : $n1=GUISetControl("icon", @windowsdir & "\cursors\horse.ani", 0,0,32,32) and a new form : GuiSetControl($n1, "",$a,0) Is this possible? Link to comment Share on other sites More sharing options...
jpm Posted April 4, 2004 Share Posted April 4, 2004 JP - I am not sure I understand...in the script above you have 2 forms of GUISetControlThe "standard" form : $n1=GUISetControl("icon", @windowsdir & "\cursors\horse.ani", 0,0,32,32)and a new form : GuiSetControl($n1, "",$a,0)Is this possible?Yes I get the right glasses. That will be in 102.16. I decide to have the updating of he text also possible.Stay tune. Link to comment Share on other sites More sharing options...
Lazycat Posted April 4, 2004 Share Posted April 4, 2004 I'm impressed with the new "avi" control. Using GuiSetControl in the main loop looks very interesting, but I need a time to play with it. And when I have seen it I remember one little thing for a long time I wanted to suggest, but always forgot about Maybe it is possible that "icon" (maybe "pic" also) control accept icons not only from *.ico files, but also from dll and exe resources, like new "avi" control does? This would be handy for making custom dialogs with the standard windows graphics. BTW if icon contains few formats in one file how to select which one will be used? Usually for me GUI shows 32x32 icons - is this OS dependent? Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
jpm Posted April 4, 2004 Share Posted April 4, 2004 I'm impressed with the new "avi" control. Using GuiSetControl in the main loop looks very interesting, but I need a time to play with it.And when I have seen it I remember one little thing for a long time I wanted to suggest, but always forgot about Maybe it is possible that "icon" (maybe "pic" also) control accept icons not only from *.ico files, but also from dll and exe resources, like new "avi" control does? This would be handy for making custom dialogs with the standard windows graphics.BTW if icon contains few formats in one file how to select which one will be used? Usually for me GUI shows 32x32 icons - is this OS dependent?Why not. how to define the icon you want to choose?Propose I try Link to comment Share on other sites More sharing options...
Holger Posted April 5, 2004 Share Posted April 5, 2004 (edited) @jpm: I played a little bit around with c++ But at the moment I can only draw like (icongroups)...I don't know how to describe that. I think it's the 32*32 Icon with 256 Colors. Cause I can't see the current source-code I used my unofficial code you know Holger expandcollapse popupHWND CGuiBox::CreateICON(const char* Text,HWND hWnd,int id,int X,int Y,int W,int H,int Style,int Exstyle) { char szBuffer[_MAX_PATH+1]; const char *szDelim, *szToken; int nTemp; HWND A; HICON hIcon; HINSTANCE hInstance=NULL; HBITMAP hBitmap; int Animate=100; if (Style==-1) Style = SS_NOTIFY; Style |= SS_ICON | WS_TABSTOP | WS_GROUP; if (Exstyle==-1) Exstyle=0; Exstyle |= 0; szToken = Text; if (Text != NULL) { A = _CreateControl(Exstyle,"static",NULL,Style,X,Y,0,0,hWnd,id,g_hInstance,NULL, false); if ( (szDelim = strpbrk(Text, "|")) != NULL) { nTemp = (int)(szDelim-Text); strncpy(szBuffer, Text, nTemp); szBuffer[nTemp] = '\0'; nTemp = atoi(szDelim+1); nTemp = nTemp - 1; if (nTemp==-1) nTemp = 0; szToken = szBuffer; hIcon=(HICON) ExtractIcon(hInstance,szToken,nTemp); SendMessage(A,(UINT)STM_SETICON,(WPARAM)hIcon,0); } else { hBitmap=(HBITMAP) LoadImage(0,Text,IMAGE_ICON,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION); SendMessage(A,(UINT)STM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hBitmap); SendMessage(A,Animate,(WPARAM)STM_SETIMAGE,(LPARAM)IMAGE_ICON); } } if (m_nCurSizeable == 0) GUICtrl[m_nMaxCtrl].nSizeable = GUI_SZ_DOCKWIDTH | GUI_SZ_DOCKHEIGHT; return A; } // CreateICON() You see that I've taken the most from the avi-function. Holger Edited April 5, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
Lazycat Posted April 5, 2004 Share Posted April 5, 2004 Why not. how to define the icon you want to choose?I leave it to your decide. It can be icon name or icon number - no matter. The way of "avi" control is quite acceptable.Selecting icon format not very important for me, but would be nice. Maybe it can be selected by giving control size and always set colors to maximal in dependence of desktop colors. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Holger Posted April 5, 2004 Share Posted April 5, 2004 (edited) @kot: at the moment it could be so in autoit3-gui: FileChangeDir(@Scriptdir) GUICreate("Animation") $icon = GUISetControl("icon","shell32.dll|10",20,20);dll in search-path $icon2 = GUISetControl("icon","explorer.icl|10",20,80);icon-library in script-dir $icon3 = GUISetControl("icon","explorer.exe|6",80,80);exe-file somewhere $ani1=GUISetControl("icon", @windowsdir & "\cursors\horse.ani",20,120,32,32) $icon4=GUISetControl("icon",@SystemDir & "\shell32.dll|7",20,160,32,32) $icon5 = GUISetControl("icon","netcard.ico",150,80);icon-file in script-dir GUIWaitClose() Exit How I've seen it is that the icons will display then in the highest color that is the current desktop-color-value... Maybe jpm finds a better or easier way Edited April 5, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView 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