Jump to content

How to create GTK GUI?


Recommended Posts

How to make GUI using GTK? I made my "Hello world" in C++ using GTK and found that GTK is just 11 MB DLLs. I tried to find out DLL functions but I didn't find. I tried to use "Olly dbg" to fund out what functions are called by "Hello world" program, but It was too difficult.

Does anyone know what functions and what dlls I need to call to create GTK GUI?

Thanks

edited

Link to comment
Share on other sites

How to make GUI using GTK?

why do you want to use GTK, when you can easily make a GUI with AutoIt?

goto scite that came with AutoIt, and under the Tools Menu, you should be able to find Koda. It's a great user-friendly GUI builder

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

You can add an icon to a button, however I am not sure about with text, but I would'nt see why not. There is also a UDF that has a skin creator for your GUI's as well, so to get away from the standard win32 look

XSkin.au3... Skin your GUI

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

Link to comment
Share on other sites

can u make button in native autoit that has icon + text

Something like this?

#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
    Local $hImage, $btn[1];, $rdo, $chk
    GUICreate("Buttons", 200, 200)
    GUISetState()

    $hImage = _GUIImageList_Create(32, 32, 5, 3, 6)
    For $x = 6 To 7
        _GUIImageList_AddIcon($hImage, "shell32.dll", $x, True)
    Next
    $btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50)
    _GUICtrlButton_SetImageList($btn[0], $hImage)
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btn[0]
                _GUICtrlButton_SetImageList($btn[0], _GetImageListHandle("shell32.dll", 7, True))
        EndSwitch
    WEnd

    Exit
EndFunc   ;==>_Main

Func _GetImageListHandle($sFile, $nIconID = 0, $fLarge = False)
    Local $iSize = 16
    If $fLarge Then $iSize = 32
    Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3)
    If StringUpper(StringMid($sFile, StringLen($sFile) - 2)) = "BMP" Then
        _GUIImageList_AddBitmap($hImage, $sFile)
    Else
        _GUIImageList_AddIcon($hImage, $sFile, $nIconID, $fLarge)
    EndIf
    Return $hImage
EndFunc   ;==>_GetImageListHandle
Link to comment
Share on other sites

  • 2 years later...
  • Moderators

prazetto, that's great that you have a script that you want to share in the Examples forum. But please do not resurrect a three year old post just to self-advertise.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13

I'm not self-advertise. Just trying to answer.

There how to create GUI with GTK.

#include <Widgets.GTK.au3>

$window = _gtk_window_new($GTK_WINDOW_TOPLEVEL)
_gtk_window_set_title($window, 'GTK Form')
_gtk_window_set_default_size($window, 400, 400)
_gtk_window_set_position($window, $GTK_WIN_POS_CENTER)
_gtk_window_set_icon_from_file($window, 'mac.ico')

_gtk_widget_show_all($window)

$hcallback = DllCallbackRegister('window_exit', 'none:cdecl', '')
_g_signal_connect_object($window, 'destroy', $hcallback)

_gtk_main()

Func window_exit()
_gtk_quit()
EndFunc

# Button. Progressbar - Graphical AutoIt3 Control (UDF) # GTK on AutoIt3 - GTK+ Framework | Widgets

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...