incepator Posted October 18, 2012 Posted October 18, 2012 how to make a algorithm to show my pictures framed Form, one under another 5 per on line? Thank you! expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <TabConstants.au3> #include <GDIPlus.au3> #Include <Memory.au3> #include <File.au3> #include <Array.au3> #include "GUICtrlPic.au3" #NoTrayIcon $Form1 = GUICreate("", 1006, 695, -1, -1, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $Tab1 = GUICtrlCreateTab(3, 3, 1001, 689) $all_dir = _FileListToArray(@ScriptDir, "*", 2) If IsArray($all_dir) Then For $i = 1 To $all_dir[0] Global $TabSheet1 = GUICtrlCreateTabItem($all_dir[$i]) $all_dir2 = _FileListToArray(@ScriptDir&"\"&$all_dir[$i], "*", 2) If IsArray($all_dir2) Then For $ii = 1 To $all_dir2[0] $Button1 = GUICtrlCreateButton($all_dir2[$ii], 24, 30*$ii+7, 171, 22, $WS_BORDER) GUICtrlSetCursor (-1, 0) _GUICtrlPic_Create(@ScriptDir&"\"&$all_dir[$i]&"\"&$all_dir2[$ii]&"\"&"template_thumbnail.png" , 200, 60*$ii-30, 176, 113, BitOR($SS_CENTERIMAGE,$SS_SUNKEN, $SS_NOTIFY), Default) GUICtrlSetTip(-1, $all_dir2[$ii]) Next EndIf Next EndIf GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndGUICtrlPic.au3
FireFox Posted October 18, 2012 Posted October 18, 2012 Hi, how to make a algorithm to show my pictures framed Form, one under another 5 per on line? What? Can you be more specific? GUICtrlCreatePic(...) Br, FireFox.
incepator Posted October 18, 2012 Author Posted October 18, 2012 ok...GUICtrlCreatePic.. how to make a algorithm to show my pictures...4 pictures per line and 5 column. ?
FireFox Posted October 18, 2012 Posted October 18, 2012 (edited) You can make a use the For statement : For $iRow = 1 To 5 For $iColumn = 1 To 4 GUICtrlCreatePic(..., $iColumn * $picwidth, $iRow * $picheight, ...) Next Next Br, FireFox. Edited October 18, 2012 by FireFox
incepator Posted October 18, 2012 Author Posted October 18, 2012 yes ... it makes sense as you say, only in the context of my script does not work expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <TabConstants.au3> #include <GDIPlus.au3> #Include <Memory.au3> #include <File.au3> #include <Array.au3> #include "GUICtrlPic.au3" #NoTrayIcon $Form1 = GUICreate("", 1006, 695, -1, -1, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $Tab1 = GUICtrlCreateTab(3, 3, 1001, 689) $all_dir = _FileListToArray(@ScriptDir, "*", 2) If IsArray($all_dir) Then For $i = 1 To $all_dir[0] Global $TabSheet1 = GUICtrlCreateTabItem($all_dir[$i]) $all_dir2 = _FileListToArray(@ScriptDir&"\"&$all_dir[$i], "*", 2) If IsArray($all_dir2) Then For $ii = 1 To $all_dir2[0] $Button1 = GUICtrlCreateButton($all_dir2[$ii], 24, 30*$ii+7, 171, 22, $WS_BORDER) GUICtrlSetCursor (-1, 0) For $iRow = 1 To 4 For $iColumn = 1 To 5 _GUICtrlPic_Create(@ScriptDir&"\"&$all_dir[$i]&"\"&$all_dir2[$ii]&"\"&"template_thumbnail.jpg" , $iColumn*200, $iRow*120, 176, 113) Next Next Next EndIf Next EndIf GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd appear exactly images ... not use $all_dir2[$ii]
FireFox Posted October 18, 2012 Posted October 18, 2012 (edited) Maybe this : (not tested) ... Local $iRow = 1, $iColumn = 1 If IsArray($all_dir2) Then For $ii = 1 To $all_dir2[0] $Button1 = GUICtrlCreateButton($all_dir2[$ii], 24, 30 * $ii + 7, 171, 22, $WS_BORDER) GUICtrlSetCursor(-1, 0) _GUICtrlPic_Create(@ScriptDir & "" & $all_dir[$i] & "" & $all_dir2[$ii] & "" & "template_thumbnail.jpg", $iColumn * 200, $iRow * 120, 176, 113) $iColumn += 1 If Not Mod($ii, 4) Then ;or $iColumn = 5 $iRow += 1 $iColumn = 1 EndIf Next EndIf ... Edit : Added Not operator. Br, FireFox. Edited October 18, 2012 by FireFox
incepator Posted October 18, 2012 Author Posted October 18, 2012 Perfect ! Congratulations! it worked, thanks a lot!
incepator Posted October 18, 2012 Author Posted October 18, 2012 How can I add a parameter like this? to display something you give click the photos displayed. ................... Select Case $pic_create[$ii] MsgBox(0,"","Name: "&$pic_create[$ii]) EndSelect
FireFox Posted October 18, 2012 Posted October 18, 2012 (edited) I only see one option (or the best which exists), the SetOnEvent UDF by martin, available Br, FireFox. Edited October 18, 2012 by FireFox
incepator Posted October 18, 2012 Author Posted October 18, 2012 (edited) I tried like this, I tried with GUICtrlSetOnEvent...but not work, does not show the name to be, $all_dir2[$ii] .. probably because $all_dir2[$ii] is not an exact variable ... Edited October 18, 2012 by incepator
FireFox Posted October 18, 2012 Posted October 18, 2012 (edited) If I linked the UDF it's because I meant this : #include "onEventFunc.au3" ... Local $aPic[UBound($all_dir2)] $aPic[$ii] = _GUICtrlPic_Create(@ScriptDir & "" & $all_dir[$i] & "" & $all_dir2[$ii] & "" & "template_thumbnail.jpg", $iColumn * 200, $iRow * 120, 176, 113) SetOnEventA($aPic[$ii], "_picevent", $paramByVal, $ii) ... Func _picevent($iPicture) ConsoleWrite($iPicture & @CrLf) EndFunc I have set as parameter the picture index, you can set what you want and more parameters. Br, FireFox. Edited October 18, 2012 by FireFox
FireFox Posted October 18, 2012 Posted October 18, 2012 Maybe... ... #NotrayIcon Opt("GUIOnEventMode", 1) $Form1 = ... Br, FireFox.
incepator Posted October 18, 2012 Author Posted October 18, 2012 (edited) I know, I added Eight ("GUIOnEventMode", 1) ... does not display the name of the picture you clicked Edited October 18, 2012 by incepator
FireFox Posted October 18, 2012 Posted October 18, 2012 does not display the name of the picture you clickedAnd where is stored the name of the picture, because all have the name "template_thumbnail.jpg".Br, FireFox.
incepator Posted October 18, 2012 Author Posted October 18, 2012 (edited) I'm sorry, I was wrong, I'm not talking about the image names , I mean the name of the folder where the image is displayed. Edited October 18, 2012 by incepator
FireFox Posted October 18, 2012 Posted October 18, 2012 SetOnEventA($aPic[$ii], "_picevent", $paramByVal, $all_dir2[$ii])
incepator Posted October 18, 2012 Author Posted October 18, 2012 Thanks, now works properly. I think I was a stress for you today. I appreciate a good night!
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