Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

make dialog (video of use)


  • Please log in to reply
2 replies to this topic

#1 Xandy

Xandy

    /X\('-')/Y\

  • Active Members
  • PipPipPipPipPipPip
  • 1,191 posts

Posted 04 May 2012 - 05:52 AM

Posted Image
make dialog and save to file.
load in your other scripts.

function to load the dialog in script.
AutoIt         
;loaddialogdata loads gui controls into a already created gui, used to insert tab page information into guis from text file func loaddialogdata($inputfile, ByRef $control, ByRef $controls) ;$controls= (filecountlines($inputfile)-1)/($controldatamax+1) $file= fileopen($inputfile) dim $controldata[$controldatamax] $jump= 0 if $file> -1 then   $zar= filereadline($file)   if $zar= "0" then    guiseticon(@scriptdir&"\system\graphics\runner icn3.ico");read/set icon   else    guiseticon(@scriptdir&"\"&$zar);read/set icon   endif   $del= filereadline($file);removes label text description   if @error<> 0 then return   do    for $i= 0 to $controldatamax-2;read in control data     $controldata[$i]= filereadline($file);data    next    $tempstr= ""    while 1; read field 14 the tooltip ex edit field     $tempstr= filereadline($file)     if @error<> 0 then      $jump= 1      exitloop     elseif stringinstr($tempstr, "control", 0, 1, 1, 7)= 1 then      exitloop     endif     $control[$controls][1]= $control[$controls][1]&$tempstr&@crlf    wend    switch $controldata[0]    case 0;label     $control[$controls][0]= guictrlcreatelabel($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6])     if $controldata[7]= 1 then      GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)     elseif $controldata[7]= 0 then     else      GUICtrlSetBkColor(-1, $controldata[7])     endif     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[9])     if $controldata[8]<> "" and  $controldata[8]<> 0 then GUICtrlSetColor($control[$controls][0], $controldata[8])     guictrlsettip($control[$controls][0], $controldata[10])    case 1;button     ;guisetfont($controldata[1], $controldata[9])     if $controldata[11]= 1 then      $control[$controls][0]= guictrlcreatebutton($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], bitor($BS_MULTILINE, 0x0080))     else      $control[$controls][0]= guictrlcreatebutton($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], 0x0080)     endif     if $controldata[7]<> "" then GUICtrlSetImage($control[$controls][0], @scriptdir&"\System\Graphics\"&$controldata[7])     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[9])     guictrlsettip($control[$controls][0], $controldata[10])    case 2;inputbox     ;guisetfont($controldata[1], $controldata[9])     if $controldata[7]= 1 then; inputbox only takes number data      $control[$controls][0]= guictrlcreateinput($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], $ES_NUMBER)     else; inputbox any string type data      $control[$controls][0]= guictrlcreateinput($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6])     endif     if $controldata[11]= 1 then GuiCtrlSendMsg($control[$controls][0], $EM_SETREADONLY, 1, 0);read-only     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[9])     guictrlsettip($control[$controls][0], $controldata[10])    case 3;graphic     $control[$controls][0]= guictrlcreategraphic($controldata[1], $controldata[2], $controldata[3], $controldata[4])     guictrlsetbkcolor(-1, $controldata[5])     if $controldata[6]= 1 then guictrlsetstate($control[$controls][0], $gui_disable)     if $controldata[7]= 1 then guictrlsetstate($control[$controls][0], $gui_ontop)    case 4;combo     ;guisetfont($controldata[1], $controldata[8])     $control[$controls][0]= guictrlcreatecombo($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], $CBS_DROPDOWNLIST)     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[8])     guictrlsettip($control[$controls][0], $controldata[9])    case 5;edit     if $controldata[12]= 1 then      $control[$controls][0]= guictrlcreateedit($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], $WS_VSCROLL)     else      $control[$controls][0]= guictrlcreateedit($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6])     endif     if $controldata[10]= 1 then guictrlsendmsg($control[$controls][0], $EM_SETREADONLY, 1, 0);read-only     if $controldata[11]= 1 then guictrlsetstate($control[$controls][0], $gui_disable)     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[8])    case 6;checkbox     ;guisetfont($controldata[1])     $control[$controls][0]= GUICtrlCreateCheckbox($controldata[2], $controldata[3], $controldata[4], $controldata[8], $controldata[9])     guictrlsettip($control[$controls][0], $controldata[7])     guictrlsetfont($control[$controls][0], $controldata[1])    case 7;listbox     ;guisetfont($controldata[1])     $control[$controls][0]= guictrlcreatelist($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], BitOR($LBS_NOTifY, $LBS_SORT, $WS_HSCROLL, $WS_VSCROLL))     guictrlsetfont($control[$controls][0], $controldata[1])    case 8;radio button     ;guisetfont($controldata[1])     $control[$controls][0]= GUICtrlCreateRadio($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6])     guictrlsetfont($control[$controls][0], $controldata[1])    case 9;start group     guistartgroup()    endswitch    $controls= $controls+1    if $jump= 1 then return   until @error<>0   fileclose($file)   guisetfont(10) endif;endif $file= greater than error ;return $hdialog EndFunc; loaddialogdata()


code to load a dialog from your scripts, modify as needed
AutoIt         
#include <WindowsConstants.au3> #include <Constants.au3> #include <ButtonConstants.au3> #include <ListboxConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #Include <GuiButton.au3> #Include <GuiListView.au3> #include <Guilistbox.au3> #include <Guicombobox.au3> #Include <GuiComboBoxEx.au3> global $controldatamax= 15 $controls= (filecountlines(@scriptdir&"\keyboard dialog.txt")-1)/($controldatamax+1); find a way to make sure you don't have too few controls dim $control[$controls][2] $controls= 0 $win= guicreate("Select a key", 700, 400) loaddialogdata(@scriptdir&"\keyboard dialog.txt", $control, $controls) $controltip= guictrlcreateedit("", 20, 90, 220, 50, $ws_vscroll) guisetstate() do $msg= guigetmsg() $a= guigetcursorinfo($win) if isarray($a) then   if $a[2]= 1 then; check for left button down to select field    for $i= 0 to $controls-1     if $control[$i][0]= $a[4] then      guictrlsetdata($controltip, $control[$i][1])      exitloop     endif    next   endif endif until $msg= $gui_event_close ;loaddialogdata loads gui controls into a already created gui, used to insert tab page information into guis from text file func loaddialogdata($inputfile, ByRef $control, ByRef $controls) ;$controls= (filecountlines($inputfile)-1)/($controldatamax+1) $file= fileopen($inputfile) dim $controldata[$controldatamax] $jump= 0 if $file> -1 then   $zar= filereadline($file)   if $zar= "0" then    guiseticon(@scriptdir&"\system\graphics\runner icn3.ico");read/set icon   else    guiseticon(@scriptdir&"\"&$zar);read/set icon   endif   $del= filereadline($file);removes label text description   if @error<> 0 then return   do    for $i= 0 to $controldatamax-2;read in control data     $controldata[$i]= filereadline($file);data    next    $tempstr= ""    while 1; read field 14 the tooltip ex edit field     $tempstr= filereadline($file)     if @error<> 0 then      $jump= 1      exitloop     elseif stringinstr($tempstr, "control", 0, 1, 1, 7)= 1 then      exitloop     endif     $control[$controls][1]= $control[$controls][1]&$tempstr&@crlf    wend    switch $controldata[0]    case 0;label     $control[$controls][0]= guictrlcreatelabel($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6])     if $controldata[7]= 1 then      GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)     elseif $controldata[7]= 0 then     else      GUICtrlSetBkColor(-1, $controldata[7])     endif     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[9])     if $controldata[8]<> "" and  $controldata[8]<> 0 then GUICtrlSetColor($control[$controls][0], $controldata[8])     guictrlsettip($control[$controls][0], $controldata[10])    case 1;button     ;guisetfont($controldata[1], $controldata[9])     if $controldata[11]= 1 then      $control[$controls][0]= guictrlcreatebutton($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], bitor($BS_MULTILINE, 0x0080))     else      $control[$controls][0]= guictrlcreatebutton($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], 0x0080)     endif     if $controldata[7]<> "" then GUICtrlSetImage($control[$controls][0], @scriptdir&"\System\Graphics\"&$controldata[7])     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[9])     guictrlsettip($control[$controls][0], $controldata[10])    case 2;inputbox     ;guisetfont($controldata[1], $controldata[9])     if $controldata[7]= 1 then; inputbox only takes number data      $control[$controls][0]= guictrlcreateinput($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], $ES_NUMBER)     else; inputbox any string type data      $control[$controls][0]= guictrlcreateinput($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6])     endif     if $controldata[11]= 1 then GuiCtrlSendMsg($control[$controls][0], $EM_SETREADONLY, 1, 0);read-only     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[9])     guictrlsettip($control[$controls][0], $controldata[10])    case 3;graphic     $control[$controls][0]= guictrlcreategraphic($controldata[1], $controldata[2], $controldata[3], $controldata[4])     guictrlsetbkcolor(-1, $controldata[5])     if $controldata[6]= 1 then guictrlsetstate($control[$controls][0], $gui_disable)     if $controldata[7]= 1 then guictrlsetstate($control[$controls][0], $gui_ontop)    case 4;combo     ;guisetfont($controldata[1], $controldata[8])     $control[$controls][0]= guictrlcreatecombo($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], $CBS_DROPDOWNLIST)     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[8])     guictrlsettip($control[$controls][0], $controldata[9])    case 5;edit     if $controldata[12]= 1 then      $control[$controls][0]= guictrlcreateedit($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], $WS_VSCROLL)     else      $control[$controls][0]= guictrlcreateedit($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6])     endif     if $controldata[10]= 1 then guictrlsendmsg($control[$controls][0], $EM_SETREADONLY, 1, 0);read-only     if $controldata[11]= 1 then guictrlsetstate($control[$controls][0], $gui_disable)     guictrlsetfont($control[$controls][0], $controldata[1], $controldata[8])    case 6;checkbox     ;guisetfont($controldata[1])     $control[$controls][0]= GUICtrlCreateCheckbox($controldata[2], $controldata[3], $controldata[4], $controldata[8], $controldata[9])     guictrlsettip($control[$controls][0], $controldata[7])     guictrlsetfont($control[$controls][0], $controldata[1])    case 7;listbox     ;guisetfont($controldata[1])     $control[$controls][0]= guictrlcreatelist($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6], BitOR($LBS_NOTifY, $LBS_SORT, $WS_HSCROLL, $WS_VSCROLL))     guictrlsetfont($control[$controls][0], $controldata[1])    case 8;radio button     ;guisetfont($controldata[1])     $control[$controls][0]= GUICtrlCreateRadio($controldata[2], $controldata[3], $controldata[4], $controldata[5], $controldata[6])     guictrlsetfont($control[$controls][0], $controldata[1])    case 9;start group     guistartgroup()    endswitch    $controls= $controls+1    if $jump= 1 then return   until @error<>0   fileclose($file)   guisetfont(10) endif;endif $file= greater than error ;return $hdialog EndFunc; loaddialogdata() func filecountlines($path); counts the amount of lines in a file $count= 0 $file= fileopen($path, 0) while(@error==0)   filereadline($file)   if(@error <> 0) then exitloop   $count= $count+1 wend fileclose($file) return $count EndFunc; end filecountlines()

It's written sloppy but was not my programming focus. If you use the Runner tool, Runner's dialogs can be edited with this script.
You can use the same system to allow users to customize your dialogs.

make dialog_pack1.zip

Edited by Xandy, 08 May 2012 - 07:21 PM.

.                                                                            |

.                                                                          |

(+_-)                                                                  _|_

..L▄︻̷̿┻̿═━一                                              ///\(x_y)/\\\

./\                                                                   ||| ` ' |||








#2 Xandy

Xandy

    /X\('-')/Y\

  • Active Members
  • PipPipPipPipPipPip
  • 1,191 posts

Posted 05 May 2012 - 06:42 AM

Updated make_dialog_pack1 with example, 'script using make_dialog.au3'.
The escape and function keys will show extended tooltips on gui.

example loads a keyboard dialog. That looks like this.Posted Image

.                                                                            |

.                                                                          |

(+_-)                                                                  _|_

..L▄︻̷̿┻̿═━一                                              ///\(x_y)/\\\

./\                                                                   ||| ` ' |||


#3 Xandy

Xandy

    /X\('-')/Y\

  • Active Members
  • PipPipPipPipPipPip
  • 1,191 posts

Posted 08 May 2012 - 07:17 PM

Video of me updating a dialog interface.


At the end of the video, I am saving the dialog to file. I didn't capture the area of that happening. I wanted to, so, opps.

Edited by Xandy, 08 May 2012 - 07:24 PM.

.                                                                            |

.                                                                          |

(+_-)                                                                  _|_

..L▄︻̷̿┻̿═━一                                              ///\(x_y)/\\\

./\                                                                   ||| ` ' |||





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users