Jump to content

Recommended Posts

Posted

is there a way to make buttons like the one in the menu? or in firefox the bookmarks toolbar and the home, go, refresh, ... buttons are like them too...

i want them to be at the background and only on mouseover at the foreground...

or said in anotherway: i want them to have no borders...

i found no extension for this, but i hope you can help me...

Posted

button styles..... check in your help file in...function reference>gui reference>Gui Control creation>GUICtrlCreateButton there is a link there for the button styles appendix... sounds to me like the one you're looking for would be $BS_FLAT, but check them out yourself and maybe experiment to find the one you like...

Posted (edited)

in my opinion i tryed ALL styles and didn't found the right one, but i can try it with $BS_FLAT...

ok tryed it and its not the one i search... i said, i want to have thje button like the one sin the menu... for example the filemenu... with very small borders only and few 3d shadow effects.

Edited by Lord_Doominik
Posted

???

WHAT

???

i'm searching a button style for buttons, that theyre like the menus... that has nothing to do with hyperlinks? i only want, that they are on mouseover a button and instead not, like in the menu or mozzille or ie... i tryed it with pics and buttons, but i need a button style, which has smaller borders... such like these at the menu on mouseover...

Posted

???

WHAT

???

i'm searching a button style for buttons, that theyre like the menus... that has nothing to do with hyperlinks? i only want, that they are on mouseover a button and instead not, like in the menu or mozzille or ie... i tryed it with pics and buttons, but i need a button style, which has smaller borders... such like these at the menu on mouseover...

<{POST_SNAPBACK}>

if you can't find someone else's solution to your problem, you may want to consider making your own....
Posted

hm... how do you make own button styles? o.O

<{POST_SNAPBACK}>

i meant make your own solution... like, you know the behavior you want, you know the behaviors that autoit can provide. if you want a solution that doesn't already exist, with some learning, you can make your own. that's the beauty of being a programmer, not having to take things 'as is' you can make them your own.
  • 7 months later...
Posted

if you can't find someone else's solution to your problem, you may want to consider making your own....

I have made a demo of how a mouseover can be achieved. There is an example of changing a label's background color and changing an image on mouseover.

I guess the label of the image could be made to look exactly like the required button.

For this example, please use these two images: http://smiffit.com/pix/go.gif and http://smiffit.com/pix/o.gif

#include <GUIConstants.au3>

Opt("MouseCoordMode", 0) ; 1 means screen, 0 active window

opt("GUIOnEventMode", 0)

; GLOBAL DECLARATIONS

Global $thisGuiTitle = "MouseOvers"; Change as needed

; Don't change these

Global $prevXPos, $prevYPos,$xpos,$ypos;

; CREATE GUI WITH LABELS AND AN IMAGE

GUICreate($thisGuiTitle, 400, 200, "", "", $WS_THICKFRAME) ; can be resized - try it

$greenLab=GUICtrlCreateLabel ("Label 1", 10, 10,50,20,$SS_CENTER ) ; will grow when window is resized

GUICtrlSetBkColor ( -1, 0x00ff00 ) ; green

$redLab=GUICtrlCreateLabel ("Label 2", 10, 30,50,20,$SS_CENTER ) ; will grow when window is resized

GUICtrlSetBkColor ( -1, 0xff0000 ); red

$xreport=GUICtrlCreateLabel ("0", 100, 10,50,20,$SS_CENTER )

$yreport=GUICtrlCreateLabel ("0", 100, 30,50,20,$SS_CENTER )

$SearchButton = GUICtrlCreatePic("go.gif", 11, 60, 27, 17)

GUISetState()

; FUNCTIONS

; Use this function to add those elements that need mouseovers

Func doMouseOvers()

; Call a function here for each item needing a rollover effect as follows:

; mouseOverChangeImage(controlID,$xpos,$ypos,"path_to_normal_image","path_to_mouseover_image")

; mouseOverChangeBk(controlID,$xpos,$ypos,normal_color,mouseover_color)

; NB The colors should be in the 0xrrggbb format - no quotation marks needed

mouseOverChangeImage($SearchButton,$xpos,$ypos,'go.gif','o.gif')

mouseOverChangeBk($greenLab,$xpos,$ypos,0x00ff00,0xffcc33)

mouseOverChangeBk($redLab,$xpos,$ypos,0xff0000,0xffcc33)

EndFunc

;;;;;;;;;;;;;;;;;;; The next four functions are best left unchanged ;;;;;;;;;;;;;;;;;;;;;

Func getMousePos()

$pos = MouseGetPos()

$xpos=$pos[0];

$ypos=$pos[1];

If $xpos == $prevXPos AND $ypos == $prevYPos Then

; do nothing

Else

doMouseOvers()

$prevXPos=$xpos

$prevYPos=$ypos

GUIctrlSetData($xreport,"Left:"&$xpos)

GUIctrlSetData($yreport,"Top:"&$ypos)

EndIf

EndFunc

Func mouseOverChangeImage($object,$xpos,$ypos,$normalImg,$overImg)

If gotcha($object) == 1 Then

GUICtrlSetImage ( $object, $overImg )

Else

GUICtrlSetImage ( $object, $normalImg )

EndIf

EndFunc ; =>mouseOverChangeImage

Func mouseOverChangeBk($object,$xpos,$ypos,$normalColor,$overColor)

If gotcha($object) == 1 Then

GUICtrlSetBkColor ( $object, $overColor )

Else

GUICtrlSetBkColor ( $object, $normalColor )

EndIf

EndFunc ; =>mouseOverChangeImage

Func gotcha($object)

Local $Vcompensator=29;

Local $Hcompensator=3;

$SBPos = ControlGetPos($thisGuiTitle, "", $object)

Local $sbLeft=$SBPos[0]+$Hcompensator

Local $sbTop=$SBPos[1]+$Vcompensator;

Local $sbW=$SBPos[2];

Local $sbH=$SBPos[3];

Local $sbRight=($sbLeft+$sbW+2)

Local $sbBot=($sbTop+$sbH+2)

If $xpos>$sbLeft AND $xpos<$sbRight AND $ypos>$sbTop AND $ypos<$sbBot Then

Return 1

Else

Return 0

EndIf

EndFunc

;;;;;;;;;;;;;;;;;;;;; Leave above functions as they are ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Run the GUI until the user closes it

While 1

$msg = GUIGetMsg()

getMousePos()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

Posted (edited)

GUICtrlCreateButton("Button", 8, 168, 72, 40, $BS_ICON)

GUICtrlSetImage(-1, "shell32.dll", 165)

GUICtrlSetTip(-1, "This is a button")

This will produce a button with only an image on it, and a mouse-over will read "This is a button".

Is this what you were asking for? Not really sure what you are asking. :o

Edited by Somniis

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
  • Recently Browsing   0 members

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