Sign in to follow this  
Followers 0
kjactive

Window style settings change during runtime

12 posts in this topic

#1 ·  Posted (edited)

I has a window I want to change style settings to durring runtime - is this posible and how, there is controls style change support but i could not find any support to make changes to windows other that minimize, maxi etc. I want to change settings from $WS_SIZEBOX,$WS_EX_TOOLWINDOW to _POPUP etc.

Is there any help outthere...

kjactive :whistle:

Edited by kjactive

Share this post


Link to post
Share on other sites



GUICtrlSetStyle()

That should do it if it works. I tried getting that to work with some Combo Boxes, and it didnt. I have yet to submit it as a bug as I am unsure if it really is a bug.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

ANYGUIv2.1.au3 has _TargetSetStyle()...which should work for any window/control.


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

GUICtrlSetStyle() don't work on already opened windows only controls, but I tryed the _TargetSetStyle() function but keep getting crashes, what do I do wrong here....

_TargetSetStyle('Replace',$WS_POPUPWINDOW,-1, $MainWin)

kjactive :whistle:

Edited by kjactive

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

try

_TargetSetStyle('Add',BitOr(-$WS_SIZEBOX,-$WS_EX_TOOLWINDOW, $WS_POPUPWINDOW),-1, $MainWin)

if you use 'replace', you probably are removing default styles that any extended styles depend on. I hesitantly put 'replace' in the function(it's probably more trouble than its worth)

Edited by quaizywabbit

[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

try

_TargetSetStyle('Add',BitOr(-$WS_SIZEBOX,-$WS_EX_TOOLWINDOW, $WS_POPUPWINDOW),-1, $MainWin)

if you use 'replace', you probably are removing default styles that any extended styles depend on. I hesitantly put 'replace' in the function(it's probably more trouble than its worth)

<{POST_SNAPBACK}>

I appreciate your insight. I will have to look into how that will fit into my program.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

try

_TargetSetStyle('Add',BitOr(-$WS_SIZEBOX,-$WS_EX_TOOLWINDOW, $WS_POPUPWINDOW),-1, $MainWin)

if you use 'replace', you probably are removing default styles that any extended styles depend on. I hesitantly put 'replace' in the function(it's probably more trouble than its worth)

<{POST_SNAPBACK}>

I hope those negative signs are not intentional. That is just asking for disaster if it is. Styles are checked in a bit-wise manner. Setting the high bit (sign bit) most definitely change the styles you are passing.

Also, that is a bug, IMO and I will file it as such to see what others think.

Share this post


Link to post
Share on other sites

try

_TargetSetStyle('Add',BitOr(-$WS_SIZEBOX,-$WS_EX_TOOLWINDOW, $WS_POPUPWINDOW),-1, $MainWin)

if you use 'replace', you probably are removing default styles that any extended styles depend on. I hesitantly put 'replace' in the function(it's probably more trouble than its worth)

<{POST_SNAPBACK}>

I have to assume that _TargetSetStyle() is not overwriting the style but rather modifying styles. So, it needs rewritten because you just can't do it how you are. To remove a style, the following pseudo code must be done:

$style = _GetStyle()
$style = BitAND($style, BitNOT($WS_SIZEBOX)); This removes the style
$style = BitOR($style, $WS_POPUPWINDOW)
_SetStyle($style)

Alternatively:

$style = _GetStyle()
If BitAND($style, $WS_SIZEBOX) Then $style = BitXOR($style, $WS_SIZEBOX); This removes the style
$style = BitOR($style, $WS_POPUPWINDOW)

And of course, WS_EX_TOOLWINDOW is an extended style so BitORing it into a style is flat out wrong.

There must be separate sections of code for adding and removing a style. Adding a style is easy, that's just a BitOR() operation. Removing a style requires un-setting the bits. Inserting a negative sign does not unset bits, in fact, it sets a new bit so what you then end up passing is no longer the original style but something completely different. The only way to unset bits is to use BitAND() and BitNOT() or use BitAND() to check for the correct bit pattern and then use BitXOR() to unset those bits. Also keep in mind that BitXOR() is basically a toggle. If the bits are set, they will be unset; if the bits are not set, they will be set. BitAND(BitNOT()), on the other hand, is like BitOR(); it will only produce one out come. That is, if the bits are set, they will be un-set, otherwise, they will be left un-set.

Share this post


Link to post
Share on other sites

try

_TargetSetStyle('Add',BitOr(-$WS_SIZEBOX,-$WS_EX_TOOLWINDOW, $WS_POPUPWINDOW),-1, $MainWin)

if you use 'replace', you probably are removing default styles that any extended styles depend on. I hesitantly put 'replace' in the function(it's probably more trouble than its worth)

<{POST_SNAPBACK}>

Are you trying to remove a bit-wise feature flag? In that case, instead of -$WS_SIZEBOX, you should use BitNot($WS_SIZEBOX) and then use BitAnd to combine them. Try

_TargetSetStyle('Add',BitOr(BitAnd(BitNot($WS_SIZEBOX),BitNot($WS_EX_TOOLWINDOW)), $WS_POPUPWINDOW),-1, $MainWin)

BitNot(1) is not the same as -1.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

Anyhow I get a instant crash - I want to toggle between a popup window and a sizebox window style attached to ESC hotkey without reactivate the gui

I can do this in other languages but autoit3 gui let me down 'for the first time' on this one - any suggestions...

kjactive :whistle:

Share this post


Link to post
Share on other sites

@Valik AND @Nutster:

THANK YOU BOTH for taking the time to explain how this works!!

(Off to fix it now)


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I updated ANYGUI to v2.2

_TargetSetStyle() should work now ( I tested "Remove" on Notepad with a timer, then "Add" to restore Styles.....no errors, worked just fine)

by default it doesn't visibly update the window until you set the "Bool" param to 1

so if adding styles/exstyles and also removing, call the function once for each "Action" and set "Bool" to 1 on the last call to update. see below:

_TargetSetStyle("Remove", 0, $WS_SIZEBOX, $WS_EX_TOOLWINDOW, $MainWin)
_TargetSetStyle("Add", 1, $WS_POPUPWINDOW,-1, $MainWin)

should make for better readability too.

Edited by quaizywabbit

[u]Do more with pre-existing apps![/u]ANYGUIv2.8

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