Sign in to follow this  
Followers 0
manelesux

Window Styles, Button Styles, all kindof styles

3 posts in this topic

Ok, i moved the discussion from the previous topic on the GUI forum.

So where was i?

After the latest advice i browsed thru MSDN till i got scared by a 1993 article defining window styles and some other articles stating that some of the window styles are obsolete or best avoided. So i got over my window edges and frames period by ignoring it. BUT...

1.I hit the wall with a more relevant issue, the default push button. The BS_DEFPUSHBUTTON should define a default button which is pushed by pressing Enter, plus some kind of thick frame. See the code below

2.Help says that if the second button doesnt explicit its dimension, it gets the height and weight from the preceding button. which doesnt seem to happen, as proved by the same script below:

#include <GUIConstants.au3>

$gui=GUICreate("Background", 800, 300, 500, 400)
$id1=GUICtrlCreateButton("I am Default",Default,Default,100,100)
$id2=GUICtrlCreateButton("I wish i could be default",150,50,Default,Default,$bs_defpushbutton)
GUISetState(@SW_SHOW)


do
    $msg = GUIGetMsg()
    IF $msg=$id1 Then MsgBox(0,"","Told ya im default")
    IF $msg=$id2 Then MsgBox(0,"","Ill never be default")
until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

If you use the keyword 'Default' for the height and width of the button, it's size will be adjusted to the buttontext !

Don't use the keyword 'Default' for the height and width of the button !

Just set a blank string to get the result ... :)

#include <GuiConstants.au3>


$gui=GUICreate("Background", 800, 300, -1, -1)
$id1=GUICtrlCreateButton("I am Default",Default,Default,110,110)
$id2=GUICtrlCreateButton('I have the same size',150,50,'','',$bs_defpushbutton)
GUISetState(@SW_SHOW)


Do
    $msg = GUIGetMsg()
    IF $msg=$id1 Then MsgBox(0,"","Told ya I'm default")
    IF $msg=$id2 Then MsgBox(0,"","Don't use 'Default', just set a blank string !")
Until $msg = $GUI_EVENT_CLOSE

I hope this is the thing you mean !?

Greetz

Edited by Greenhorn

Share this post


Link to post
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
Sign in to follow this  
Followers 0