axe.win32maxgui version 28 released

BlitzMax Forums/MaxGUI Module/axe.win32maxgui version 28 released

skidracer(Posted 2007) [#1]
Finally admitted defeat trying to implement an htmlview in pure bmx so there is a new msHtmlView implementation which seems to be working pretty good.

Looking forward to making some progress now that little hurdle is hopefully passed.

win32 users, syncmods away...

I've also uploaded a ready built version of MaxIDE which I haven't played with too much but the help system seems to be managing with the new msHtmlView and general performance seems to be very good.

Place in your BlitzMax folder and give it a whirl:

http://www.gameartnow.com/nitrologic/MaxIDETurbo.zip


BlackSp1der(Posted 2007) [#2]
wow, thanks skid!


Ziltch(Posted 2007) [#3]
Looks good to me!

Checked out the help in your updated IDE and seems to working well.

Thanks!


SebHoll(Posted 2007) [#4]
Whoooooooooooooooooooooooooooooooo! :-P

And I never thought I'd see the day! Glad to see you've decided to start development again! That IDE certainly is turbo-charged now - it's highlighting the MaxIDE source on my computer in about 1.5 seconds!!! Well-done! Btw, I thought I'd look for some bugs and have listed them below (some of them have been mentioned in the previous thread but are still broken):

1. GadgetText() returns an empty string for windows, buttons and labels. Fix below!

2. Labels with the separator flag don't display.

3. EVENT_MENUACTION events do not have an EventSource().

4. No hotkey text is display for a menu which is assigned to non alpha-numberic keys (inc. Delete, Insert, Print Screen, Return, Space, Plus, Minus, Escape, Home, End, Page Up, Page Down) - looks like it will be a quick-fix in TWindowsMenu.SetHotKey(). I've nabbed Grisu's screenshot for demonstration... Fix below!



5. Textareas allow you to change the alignment of selected text by using the default keyboard shortcuts (Left: Ctrl+L, Center: Ctrl+E, Right: Ctrl+R [right alignment doesn't work in IDE as this is the shortcut for running modules]) and you can change the font size either by using Ctrl+Shift+> / Ctrl+Shift+<, or by holding Ctrl while spinning the mouse wheel.

6. HtmlViews still allows you to cut text from it by selecting the text, and hitting Ctrl+X.

7. SetMinWindowSize() doesn't seem to work very well (see source code below).

8. Panels don't seem to like it when you change the pixmap.

Here's some test code for points 7 and 8:



9. I like the idea of having the XP manifest file built in to Axe.Win32MaxGUI but it seems to break any other imported object files (that may, for example, include icons). This is visible both when compiling MaxIDE and when compiling my own project with its own custom icon set.

10. EVENT_MOUSEMOVE is constantly being emitted by an active panel regardless of whether the cursor is actually moving (that's strange - it seems to be happening for both Axe.Win32MaxGUI and BRL.Win32MaxGUI). I've nabbed my example from the OS X thread which seems to demonstrate it well.



11. Computer "beeps" when an item is clicked in a list view (apparent in the CreateListView() example).

Lol, I know that's quite a list. I can cross them off as and when like I'm doing for Brucey in the MaxGUI on OS X thread.

Thanks!


Mark Tiffany(Posted 2007) [#5]
Agreed, textarea performance is much improved, however, it's not doing anything with styles like bold & italics (hopefully this isn't why it's so much faster!).

Oh, and I love the way toolbar icons grey out rather than simply block out.

I may well fully switch the CE IDE over to this now, should help track down any bugs for you.


SebHoll(Posted 2007) [#6]
Agreed, textarea performance is much improved, however, it's not doing anything with styles like bold & italics (hopefully this isn't why it's so much faster!).

That's strange, after Skid applied the SetStyle fix for v0.27, they have been working fine for me. In my MaxIDE, I have Keywords in bold, and comments in italics. Are you sure you've sync'd to v0.28?

Oh, and I love the way toolbar icons grey out rather than simply block out.

Same here! :-)


SebHoll(Posted 2007) [#7]
I've spent the day trying to fix some of the colour/transparency/alpha issues in Axe.Win32MaxGUI:


See the bottom of the post, for this demo's source.

Note: all these changes are made to BlitzMax\mod\axe.mod\win32maxgui.mod\win32maxgui.bmx .

You need to add some constants and functions to the top of the file (they don't appear to have been added yet to Pub.Win32):

Const LWA_COLORKEY=1
Const LWA_ALPHA=2
Const LWA_BOTH=3
Const TRANSPARENT=1
Const OPAQUE = 2

'This function is only supported by Win 2000+, therefore we use the DLL.
Global SetLayeredWindowAttributes(hwnd,crKey,bAlpha:Byte,dwFlags) "win32"
Global libUser32 = LoadLibraryA("user32.dll")
SetLayeredWindowAttributes = GetProcAddress(libUser32, "SetLayeredWindowAttributes")
And then this needs to go inside the Extern "win32" block:

Function SetBkMode( hdc, mode)
Function GetParent( hwnd )
Function SetTextColor( hdc, crColor)
OK, now you are ready to begin!


1. Alpha and Background Colours for Window Gadget:

Firstly, under TWindowsWindow.WndProc(), insert the following into the Select msg...Case block:

			Case WM_ERASEBKGND
				If _brush Then
					Local rect[4]
					GetClientRect( _hwnd, rect )
					FillRect( wp, rect, _brush )
					Return 1
				EndIf
				Return 0
Next, add the following method to the bottom of the TWindowsWindow type:

	Method SetAlpha( alpha# )
		If SetLayeredWindowAttributes Then
			Local tmpStyle% = GetWindowLongW(_hwnd, GWL_EXSTYLE)
			If Not (tmpStyle & WS_EX_LAYERED) Then SetWindowLongW(_hwnd, GWL_EXSTYLE, tmpStyle|WS_EX_LAYERED)
			SetLayeredWindowAttributes( _hwnd, 0, Byte(alpha*255), LWA_ALPHA)
		EndIf
	EndMethod
That was easy wasn't it. Unfortunately, label colours and transparency is more complicated.


2. Transparent Labels and Colours for Labels/Textfields:

First, you need to add the following to the bottom of TWindowsLabel.Create(), just before Return Self.

		_brush = GetStockObject(NULL_BRUSH)
Next, you need to copy and paste these methods into TWindowsLabel, just below the Create() method.

	Method WndProc(hwnd,msg,wp,lp)
		Select msg
			Case WM_ERASEBKGND;Return 1
		EndSelect	
	EndMethod
	
	Method SetText(text$)
		InvalidateRect(GetParent(_hwnd),[xpos,ypos,xpos+width,ypos+height],True)
		Super.SetText(text$)
	EndMethod
You then need to add the following method to TWindowsGadget (I put it just below the SetColor() method)...

	Method SetTextColor(r,g,b)
		_textcolor = (b Shl 16) | (g Shl 8) | r
		InvalidateRect _hwnd,Null,True
	End Method
You also need to add a _textcolor field to the type too. Place this with the rest of the field declarations in the TWindowsGadget type.

	Field _textcolor = -1
Nearly there, replace the the Case WM_CTLCOLORSTATIC, WM_CTLCOLOREDIT section in TWindowGUIDriver.ClassWndProc() with...

			Case WM_CTLCOLORSTATIC, WM_CTLCOLOREDIT
				owner=TWindowsGadget(GadgetMap.ValueForKey(String(lp)))	
				If owner
					If owner._textcolor > -1 Then
						SetTextColor(wp, owner._textcolor)
					EndIf
					If owner._brush Then
						SetBkMode(wp, TRANSPARENT)
						Return owner._brush
					EndIf
				EndIf
Next, you need to remove the WS_CLIPCHILDREN flags from TWindowsPanel.Create(), otherwise a background won't be drawn under the label for you to see! For some reason, you don't need to do this for TWindowsWindow.

Finally, you need to simply delete the TWindowsTextField.SetColor() and TWindowsTextField.SetTextColor() methods. The method they were using didn't work for Textfields, and now that the generic gadget colour-handling methods are working, we don't need them anymore. Once these have been removed, you will notice that TextFields are coloured properly.


3. Fix for Listbox Background Colour

Basically, although setting a listbox's background colour will change the colour for most of it, the background surrounding the text is still white (which look really ugly), but fortunately it has a simple fix. Add the following line to TWindowsListBox.SetColor():

SendMessageW _hwnd,LVM_SETTEXTBKCOLOR ,0,(b Shl 16)|(g Shl 8)|r
It doesn't really matter whether it goes before or after the message that's already there.

---

I know some want to get transparent buttons/checkboxes, and after having trying desperately to find out how it is done, I found that you can't (unless, you manually handle the WM_PAINT message and draw the control yourself). :-(

Let me know if you have any problems with any of these tweaks as we could get this into the official mods, if Skid sees them fit for public consumption.

P.S. Here's that nice little clock demo that tests some of the above tweaks (tick-tock):




andre72(Posted 2007) [#8]
I don't know why - but I can't start NaxIDETurbo here (W2K).
At the TaskManager the process is shown with 50% CPU time constant - but there's nowhere the IDE visible ...


grable(Posted 2007) [#9]
I don't know why - but I can't start NaxIDETurbo here (W2K).
At the TaskManager the process is shown with 50% CPU time constant - but there's nowhere the IDE visible ...

I get the same here, and im on XP :(


Mark Tiffany(Posted 2007) [#10]
If you run the IDE without putting it in the blitzmax directory, or setting up the BLITZMAXPATH environment variable, it will hang like this - caused by a bug in BRL.MaxUtil.BlitzMaxPath().

See post in BlitzMax bug reports for details.


SebHoll(Posted 2007) [#11]
In a bid to keep the momentum going, here are some more fixes... ;-)

4. GadgetText() implementation

Note: Again, all changes are made to win32maxgui.bmx.

Add the following to the Extern "Win32" block at the top of the source file:

Function GetWindowTextLengthW( hwnd )
Function GetWindowTextW( hwnd, lpString:Short Ptr, nMaxCount)
Then, replace the current TWindowsGadget.GetText() method with...

	Method GetText$()
		Local strText:Short[GetWindowTextLengthW(_hwnd)+1]	'Must include NULL terminator.
		GetWindowTextW _hwnd, strText, strText.length
		Return String.FromWString( strText )
	End Method

5. Menu HotKey Text Fix for Special Keys

Replace the whole of TWindowsMenu.SetHotKey() with...

	Method SetHotKey(keycode,modifier)
		_hotkeycode=keycode
		_modifier=modifier
		
		Local	m$
		If keycode>=KEY_0 And keycode<=KEY_9
			m$=Chr(keycode)
		ElseIf keycode>=KEY_A And keycode<=KEY_Z
			m$=Chr(keycode)
		ElseIf keycode>=KEY_F1 And keycode<=KEY_F12
			m$="F"+(keycode+1-KEY_F1)
		ElseIf keycode>=KEY_NUM0 And keycode<=KEY_NUM9
			m$="Num "+(keycode+1-KEY_NUM0)
		Else
			Select keycode
				Case KEY_BACKSPACE;m = "Backspace"
				Case KEY_TAB;m = "Tab"
				Case KEY_ESCAPE;m = "Esc"
				Case KEY_SPACE;m = "Space"
				Case KEY_ENTER;m = "Enter"
				Case KEY_PAGEUP;m = "PageUp"
				Case KEY_PAGEDOWN;m = "PageDown"
				Case KEY_END;m = "End"
				Case KEY_HOME;m = "Home"
				Case KEY_LEFT;m = "Left"
				Case KEY_RIGHT;m = "Right"
				Case KEY_UP;m = "Up"
				Case KEY_DOWN;m = "Down"
				Case KEY_INSERT;m = "Insert"
				Case KEY_DELETE;m = "Delete"
				Case KEY_TILDE;m = "~~"
				Case KEY_MINUS;m = "-"
				Case KEY_EQUALS;m = "="
				Case KEY_OPENBRACKET;m = "["
				Case KEY_CLOSEBRACKET;m = "]"
				Case KEY_BACKSLASH;m = "\"
				Case KEY_SEMICOLON;m = ";"
				Case KEY_QUOTES;m = "'"
				Case KEY_COMMA;m = ","
				Case KEY_PERIOD;m = "."
				Case KEY_SLASH;m = "/"
				Case KEY_NUMMULTIPLY;m = "Num *"
				Case KEY_NUMADD;m = "Num +"
				Case KEY_NUMSUBTRACT;m = "Num -"
				Case KEY_NUMDECIMAL;m = "Num ."
				Case KEY_NUMDIVIDE;m = "Num /"
			EndSelect
		EndIf
		
		If m
			If modifier&1 m$="Shift+"+m$
			If modifier&2 m$="Ctrl+"+m$
			If modifier&4 m$="Alt+"+m$
			m="~t"+m
		EndIf
		_shortcut$=m
		
		If Not iteminfo
			iteminfo=New MENUITEMINFOW
			iteminfo.cbSize=SizeOf(iteminfo)
		EndIf
		iteminfo.fMask=MIIM_TYPE
		iteminfo.dwTypeData=(Localize(name)+_shortcut).toWString()					
		SetMenuItemInfoW _pmenu,_item,True,iteminfo

		Local ev:TEvent
		ev=CreateEvent( EVENT_MENUACTION, Self,_tag )
		_hotkey=SetHotKeyEvent(keycode,modifier,ev,findownerhwnd(Self))
	End Method
Enjoy!


Mark Tiffany(Posted 2007) [#12]
One thing that I could really do with is access to the width of a proportional font on all platforms. i.e. FontWidth(font) and TGUIFont.width.


SebHoll(Posted 2007) [#13]
One thing that I could really do with is access to the width of a proportional font on all platforms. i.e. FontWidth(font) and TGUIFont.width.

Brucey's BaH.FontConfig module includes many functions that can return font information, including the font width.


Mark Tiffany(Posted 2007) [#14]
Will check it out - I had been avoiding adding extra non-core modules in the CE IDE. Ideally the font width in brucey's function should be added to maxgui - as it is a pretty obvious but simple omission from the TGUIFont!


Mark Tiffany(Posted 2007) [#15]
Actually, Brucey's module is for LoadImageFont, not LoadGUIFont. And looking at that made me realise that I could (somewhat inefficiently) also load the imagefont and get the textwidth off that in order to define the width of the GUIFont. Maybe. Worth a shot anyway.


skidracer(Posted 2007) [#16]
Seb, awesome work! Can you email me your latest version and I'll upload to syncmods.


SebHoll(Posted 2007) [#17]
Seb, awesome work! Can you email me your latest version and I'll upload to syncmods.

I've sent it to the e-mail address in your profile. Thanks! Btw, if you post when it's uploaded, I can cross off the fixed bugs above. ;-)


SebHoll(Posted 2007) [#18]
Skid: Any chance you could have a look at this, this weekend?


SebHoll(Posted 2007) [#19]
Skid: Any chance you could have a look at this, this weekend?

Just tried syncmods this morning, and v1.30 is up! Thanks - you've spurred me on to do some more bug fixing, including:

ModuleInfo "History: 0.31 Release"
ModuleInfo "History: Fixed LABEL_SEPARATOR flag"
ModuleInfo "History: Fixed EVENT_MENUACTION so that it specifies the menu as the source"
ModuleInfo "History: Added menu SetText() method"
ModuleInfo "History: Added PANEL_GROUP background colour support"
ModuleInfo "History: Removed Birdie's WINDOW_TOOL code that was causing tool windows to stay on top of *all* other windows"

Do you still want me to write-out all the tweaks in this thread, or should I just e-mail you my latest win32maxgui.bmx? Edit: Check your mailbox ;-)

Also, I've had a look at the changing panel pixmap bug and the EVENT_MOUSEMOVE flooding problem, but everything I've tried hasn't worked. I think it will be something Skid will have to try and work out himself, as I'm stuck for ideas now.

Finally, can I ask what the treeview fix in v1.30 is for, as it's making all treeview nodes (e.g. those in MaxIDE) expand as soon as any child is added, which is slowing down the start-up time considerably?

Cheers


hub(Posted 2007) [#20]
newbie question, how to use the axe version inside my project (i've axe module synchronised) ?


SebHoll(Posted 2007) [#21]
newbie question, how to use the axe version inside my project (i've axe module synchronised) ?

All you need to do is add...

Import Axe.Win32MaxGUI
...at the top of your code, and your program will use the new MaxGUI driver.


JoshK(Posted 2007) [#22]
Is this ready to use in place of brl.win32maxgui? Are there any issues when switching?


klepto2(Posted 2007) [#23]
AS far as I can see it works pretty stable, it seems that there are some issues with the textarea but I have to figure out more details to post it as a bug. When I'm adding text to the textarea while it is locked I first have to unlock it and relock it to colorize parts of it. Some return values like TextAreaChar() maybe return something different as the original brl.win32maxgui.

Generally it is much better and faster than the standard one.


SebHoll(Posted 2007) [#24]
Is this ready to use in place of brl.win32maxgui? Are there any issues when switching?

Over to you Skid... ;-) Did you get the latest version I sent you last week?


JoshK(Posted 2007) [#25]
Does EventSource() now return the menu gadget?


SebHoll(Posted 2007) [#26]
Leadworks: My latest bug-fix release that I sent to Skidracer a week ago (see my previous post) has this along with some other things fixed but it looks as though it hasn't been added to syncmods yet - when Skid uploads v0.31, it should be fixed.


SebHoll(Posted 2007) [#27]
OK, seeing as Skid hasn't yet uploaded v1.31, I'll post the tweaks which you can apply yourself over v1.30:

Note: Again, all these fixes should be applied to BlitzMax/mod/axe.mod/win32maxgui.mod/win32maxgui.bmx.

1. Add LABEL_SEPARATOR Support

Replace the TWindowsLabel.Create() method with the following:

	Method Create:TWindowsLabel(group:TGadget,style)	
		Local	xstyle,wstyle,hotkey
		Local	hwnd,parent
		
		xstyle=0
		wstyle=WS_CHILD|SS_NOPREFIX|WS_VISIBLE
		
		Select style&24
			Case 0 wstyle:|SS_LEFT
			Case 8 wstyle:|SS_RIGHT
			Case 16 wstyle:|SS_CENTER
		End Select
		Select style&7
			Case 1 wstyle:|WS_BORDER
			Case 2 wstyle:|SS_SUNKEN
			Case 3 wstyle:|SS_ETCHEDFRAME
		End Select
		
		parent=group.query(QUERY_HWND_CLIENT)
		hwnd=CreateWindowExW(xstyle,"STATIC","",wstyle,0,0,0,0,parent,hotkey,GetModuleHandleW(Null),Null)
		SendMessageW hwnd,WM_SETFONT,TWindowsGUIDriver.GDIFont.handle,1
		
		Register GADGET_LABEL,hwnd					
		
		Return Self
	End Method

2. Fixed EVENT_MENUACTION so that it specifies the menu as the source, and add SetText() method

Add the following immediately beneath the Field declarations in TWindowsMenu.

	Field	_key = SetNewKey()
	
	Global keymap:TMap=New TMap 'key,gadget
	Global keycount=100
	
	Method SetNewKey%()
		keycount:+1
		keymap.Insert( String(keycount), Self )
		Return keycount
	EndMethod
	
	Function GetMenuFromKey:TWindowsMenu(pKey%)
		Return TWindowsMenu(keymap.ValueForKey(String(pKey)))
	EndFunction
	
	Method SetText(pText$)
		name = pText
	EndMethod
Add the following line to the TWindowsMenu.Free() method...

		keymap.Remove(String(_key))
Then replace TWindowsMenu.Open() with...

	Method Open(popup=False)	'root,sub,
		Local dad:TWindowsMenu				
		Local kid:TWindowsMenu				
		
		dad=TWindowsMenu(parent)
		If dad
			_pmenu=dad._hmenu
			If Not _pmenu Throw "skidracer come here"
			_item=GetMenuItemCount(_pmenu)
			If name
				AppendMenuW _pmenu,MF_STRING,_key,(Localize(name)+_shortcut).ToWString()
			Else
				AppendMenuW _pmenu,MF_SEPARATOR,_key,Null
			EndIf
			If kids.count()
				_hmenu=CreateMenu_()
				iteminfo.fMask=MIIM_SUBMENU
				iteminfo.hSubMenu=_hmenu					
				SetMenuItemInfoW _pmenu,_item,True,iteminfo
			EndIf
			If _state&STATE_DISABLED SetEnabled(False)
			If _state&STATE_SELECTED SetSelected(True)
		Else
			If popup
				_hmenu=CreatePopupMenu()
			Else
				If kids _hmenu=CreateMenu_()
			EndIf
		EndIf
		For kid=EachIn kids
			kid.Open
		Next
	EndMethod
Next, overwrite the TWindowsWindow.OnCommand() method with these two:

	Method OnCommand(msg,wp)
		If wp>100 Then HandleMenuEvent(msg,wp)
	End Method
	
	'Seb was here
	Method HandleMenuEvent( msg, wp )
		Local tmpMenuSource:TWindowsMenu = TWindowsMenu.GetMenuFromKey(wp), tmpMenuID
		If tmpMenuSource Then tmpMenuID = tmpMenuSource._tag
		PostGuiEvent EVENT_MENUACTION,tmpMenuSource,tmpMenuID,0,0,0,popupextra
	EndMethod
	'Seb gone
Finally, in TWindowsWindow.WndProc(), find and replace the Case WM_COMMAND block with:

			Case WM_COMMAND
				If wp>100 Then HandleMenuEvent(wp,msg)

3. Improve Background Colour Support for PANEL_GROUP

Add the following line under _type=PANELGROUP, in TWindowsPanel.Create():

			_brush=GetStockObject(NULL_BRUSH)
And then add this method to the TWindowPanel type:

	'Seb was here
	Method SetText(text$)
		InvalidateRect(GetParent(_hwnd),[xpos,ypos,xpos+width,ypos+height],True)
		Super.SetText(text$)
	EndMethod
	'Seb gone

4. Remove Birdie's WINDOW_TOOL fix that was causing tool windows to float above all other window

Quite simply, comment out the section starting and ending with 'Birdie was here and 'Birdie gone in TWindowsWindow.Create().

Let me know if you have any problems!


SebHoll(Posted 2007) [#28]
Here are my tweaks for this weekend - these fixes weren't in the version I e-mailed to Skidracer...


5. Fixed Panel Pixmap Changing Bug

Replace TWindowsPanel.SetPixmap() with...

	Method SetPixmap(pixmap:TPixmap,flags)
		If _bitmap DeleteObject _bitmap;_bitmap = 0
		If pixmap
			If pixmap.format=PF_RGBA8888 Or pixmap.format=PF_BGRA8888
				_bitmap=BitmapFromPixmap32( pixmap )
			EndIf
			If _bitmap 
				_hasalpha=True
			Else
				_bitmap=BitmapFromPixmap24( pixmap )
				_hasalpha=False
			EndIf
			_bitmapflags=flags
			_bitmapwidth=pixmap.width
			_bitmapheight=pixmap.height
		EndIf
		InvalidateRect _hwnd,Null,True
	End Method

6. Fix panels events problems (inc. recurring EVENT_MOUSEMOVE, EVENT_MOUSEWHEEL being generated on all panels regardless of whether they were made active or not)

Add the the following declaration immediately beneath the other field declarations in TWindowsPanel:

	Field	intOldCursorPos%[]
Replace the Case WM_MOUSEWHEEL and Default blocks within the TWindowsPanel.WndProc() Select...Case block with:

			Case WM_MOUSEMOVE
				
				If intOldCursorPos.length = 2 And intOldCursorPos[0] = (lp&$ffff) And intOldCursorPos[1] = (lp Shr 16) Then Return 0 Else intOldCursorPos = [lp&$ffff, lp Shr 16]
				If _active Then bbSystemEmitOSEvent hwnd,msg,wp,lp,Self;Return 0
			
			Case WM_MOUSEWHEEL
				
				Local p[2]
				p[POINT_X]=lp&$ffff
				p[POINT_Y]=lp Shr 16
				If _active Then bbSystemEmitOSEvent hwnd,WM_MOUSEWHEEL,wp,(p[POINT_Y] Shl 16)|(p[POINT_X]),Self;Return 0	
								
			Default
			
				If _active Then bbSystemEmitOSEvent hwnd,msg,wp,lp,Self;Return 0


I've been trying to get Tabbers to redraw properly after being resized, but I'm stumped. If you compile the IDE, the tabs only show up when you roll your mouse over the area where they should be, and doing any sort of resizing (either by resizing the window, or using the make-shift splitter) makes their tabs disappear.


JoshK(Posted 2007) [#29]
I think it is really cool that this whole thing is done in bmx code. So much easier to handle Windows API that way, and more easily tweakable.

See my own tweaks here:

RequestFile with an option button and callback:
http://blitzmax.com/Community/posts.php?topic=65017#725746

Dialog Window Style (no icon):
http://blitzmax.com/Community/posts.php?topic=64997#725493


Mark Tiffany(Posted 2007) [#30]
There's a bug in the tabber in that gadgets don't get properly like on the original version of maxgui - see below.

There also appears to be slightly different behaviour on the brl and axe versions of win32maxgui in respect of clientwidths.



Grisu(Posted 2007) [#31]
Where can we download the newest version of the module?


skidracer(Posted 2007) [#32]
axe.win32maxgui 0.33 with Sebs last pixmap changing and mousemove eventflood fixes (slightly refactored) is now up on modserver128


Grisu(Posted 2007) [#33]
Thanks Skid!


Grisu(Posted 2007) [#34]
@Seb: Found minor issues (AXE 37):
a) When maximizing a textarea the textfield isn't refreshed properly. In some case the scrollbar of the original (small) textarea still shows up. / graphical glitch *tested, also present in the original module
b) tiny icons aren't displayed in listboxes
c) toolbaricons aren't displayed
d) canvas drawing in different windows affecting each other.


Direkt link to an example shot a)-c) errors in action =>http://img502.imageshack.us/img502/2728/errorsmf0.jpg

Working on tiny example codes. After having a new coffee. :)

Thanks for all the hard work guys!


Grisu(Posted 2007) [#35]
Bug b: Listboxicons = invisible


Example code and iconset:
"dreif.png"

I'm sure the code can be cut down further...
SuperStrict 

?Win32
Import axe.win32maxgui
'Import brl.Win32Maxgui

Local Style:Int = WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CLIENTCOORDS | WINDOW_MENU | WINDOW_HIDDEN'|WINDOW_STATUS 
Global MyWindow:TGadget = CreateWindow(" AXE ERROR APP", (GadgetWidth (Desktop ()) - 792) / 2, (GadgetHeight(Desktop ()) - 400) / 2, 792, 400, Null, Style) 
SetMinWindowSize(MyWindow, 792, 400) 

Local ClientW:Int = ClientWidth(MyWindow) 
Local ClientH:Int = ClientHeight(MyWindow) 
Local CanH:Int = (ClientH - 401) / 2
Local CanW:Int = (ClientW - 792) / 2

' Create the a Panel for the main window
Global MainPanel:TGadget = CreatePanel(0, 0, 800, 400, MyWindow, PANEL_ACTIVE) 
HideGadget(MainPanel) 
SetGadgetLayout MainPanel, 1, 1, 1, 1

'SubPanels
Global SubPanel1:TGadget = CreatePanel(ClientW - 340, 0, 340, ClientH, MainPanel, PANEL_ACTIVE) '|PANEL_BORDER)
SetGadgetLayout SubPanel1, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED

Global TrailerStrip:TIconStrip  = LoadIconStrip(LoadPixmapPNG("dreif.png")) <- example ICONIMAGE!! 
Global TrailerBox:TGadget = CreateListBox(0, 3, 337, 336, SubPanel1, 1) 

SetGadgetIconStrip(TrailerBox, TrailerStrip) 
For Local i:Int = 1 To 100
   AddGadgetItem TrailerBox, "Item: "+i, GADGETITEM_NORMAL, 1
Next

ShowGadget MainPanel 
ShowGadget MyWindow

While True
	WaitEvent 
	'Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend



Grisu(Posted 2007) [#36]
Bug c: Toolbaricons = invisible


Example code and iconset:
"buttons_all.png"

SuperStrict 

?Win32
'Import axe.win32maxgui

Local Style:Int = WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CLIENTCOORDS | WINDOW_MENU | WINDOW_HIDDEN'|WINDOW_STATUS 
Global MyWindow:TGadget = CreateWindow(" AXE ERROR APP C", (GadgetWidth (Desktop ()) - 792) / 2, (GadgetHeight(Desktop ()) - 400) / 2, 792, 400, Null, Style) 
SetMinWindowSize(MyWindow, 792, 400)  

Local ClientW:Int = ClientWidth(MyWindow) 
Local ClientH:Int = ClientHeight(MyWindow) 
Local CanH:Int = (ClientH - 401) / 2
Local CanW:Int = (ClientW - 792) / 2

' Create the a Panel for the main window
Global MainPanel:TGadget = CreatePanel(0, 0, 800, 400, MyWindow, PANEL_ACTIVE) 
HideGadget(MainPanel) 
SetGadgetLayout MainPanel, 1, 1, 1, 1

'SubPanels
Global SubPanel1:TGadget = CreatePanel(ClientW - 340, 0, 340, ClientH, MainPanel, PANEL_ACTIVE) '|PANEL_BORDER)
SetGadgetLayout SubPanel1, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED

Global TrailerPan:TGadget = CreatePanel(0, 370, 95, 34, SubPanel1) ',PANEL_BORDER,"")
Global TrailerPan2:TGadget = CreatePanel(0, - 2, 95, 34, TrailerPan) 
Global Trailertools:TGadget = CreateToolBar(LoadPixmapPNG("buttons_all.png"), 0, - 2, 0, 0, TrailerPan2) 
'SetToolBarTips Trailertools, ["Start", "Pause", "Stopp"] 

ShowGadget MainPanel 
ShowGadget MyWindow

While True
	WaitEvent 
	'Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend



SebHoll(Posted 2007) [#37]
Whoops, on approx line 3242, can you replace...

						If (ReadPixel(pix,x,y) & $FFFFFF) <> $FFFFFF Then WritePixel(pix2,x,y,$FFFFFF)
...with...

						If (ReadPixel(pix,x,y) & $FFFFFF) = $FFFFFF Then WritePixel(pix2,x,y,$FFFFFF)
Then, rebuild modules and try again!

Basically, I accidentally introduced this bug as part of the new alpha support processing in TWindowsIconStrip. If you are using Windows XP+ and you specify a pixmap (with an alpha channel) as an iconstrip, your icons will also support alpha. Otherwise the icons are handled as they were previously i.e. any white pixels are simply masked.


Grisu(Posted 2007) [#38]
That fixed both. Thanks!


Grisu(Posted 2007) [#39]
New issue found... :(

Bug e): Child windows show up "behind" the main/parent window when the main/parent window itself is maximized.

Example code:
SuperStrict 

?Win32
Import axe.win32maxgui

Local Style:Int = WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CLIENTCOORDS | WINDOW_MENU | WINDOW_HIDDEN'|WINDOW_STATUS 
Global MyWindow:TGadget = CreateWindow(" AXE ERROR APP", (GadgetWidth (Desktop ()) - 792) / 2, (GadgetHeight(Desktop ()) - 400) / 2, 792, 400, Null, Style) 
SetMinWindowSize(MyWindow, 792, 400)  ' 305 = 3x; 401 = 4x, 1024x595?
Global button:TGadget=CreateButton("Maximize Window and press this button!",10,82,270,24,Mywindow,BUTTON_OK)


Global AboutWindow:TGadget = CreateWindow(" Info", (GadgetWidth (Desktop ()) - 462) / 2, (GadgetHeight(Desktop ()) - 272) / 2, 462, 272, MyWindow, WINDOW_TITLEBAR | WINDOW_HIDDEN | WINDOW_CLIENTCOORDS) 


Local ClientW:Int = ClientWidth(MyWindow) 
Local ClientH:Int = ClientHeight(MyWindow) 
Local CanH:Int = (ClientH - 401) / 2
Local CanW:Int = (ClientW - 792) / 2

' Create the a Panel for the main window
Global MainPanel:TGadget = CreatePanel(0, 0, 800, 400, MyWindow, PANEL_ACTIVE) 
HideGadget(MainPanel) 
SetGadgetLayout MainPanel, 1, 1, 1, 1

'SubPanels
Global SubPanel1:TGadget = CreatePanel(ClientW - 340, 0, 340, ClientH, MainPanel, PANEL_ACTIVE) '|PANEL_BORDER)
SetGadgetLayout SubPanel1, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED

ShowGadget MainPanel 
ShowGadget MyWindow

While True
	WaitEvent 
	'Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_GADGETACTION
			ShowGadget AboutWindow
	End Select
Wend



Grisu(Posted 2007) [#40]
Think bug d) was releated to my code.

When using 2 canvas:
1. in the main window
2. in the child window

Changing "Setalpha vaule" affects both.

In the old module it did somehow only affect the one canvas currently in use via "SetGraphics CanvasGraphics (MyCanvas)".


Grisu(Posted 2007) [#41]
Graphical Glitch f):
DESELECTED listbox items show an ACTIVATED icon and TRUE ALPHA TRANSPARENCY is missing.

Modules: Maxgui and AXE 37

Example image:


P.S.: Caps are for emphasis only. Don't worry... :D


SebHoll(Posted 2007) [#42]
Graphical Glitch f):
DESELECTED listbox items show an ACTIVATED icon and TRUE ALPHA TRANSPARENCY is missing.

I'm not sure what you mean - please could you clarify and/or post a working example?


Grisu(Posted 2007) [#43]
Sorry, will try again.



Image1: Selected/Activated item
Image2: A passive item

The icon marked in green border shouldn't have "blue dots" on it, instead grayscale ones (same as the item text background).

You can take the bug b) example.


Grisu(Posted 2007) [#44]
^^ All bugs I mentioned above have been fixed. - Seb rocks... and my ugly example codes as well. :)

Axe 0.38 is here...


SebHoll(Posted 2008) [#45]
Just to let people know, v0.42 is up on SVN - please can everyone download and test?


DavidDC(Posted 2008) [#46]
Silly Q: Which folder in the SVN is it Seb?


SebHoll(Posted 2008) [#47]
Silly Q: Which folder in the SVN is it Seb?

http://www.blitzbasic.com:81/svn/maxgui/dev/maxgui.mod


Difference(Posted 2008) [#48]
@SebHoll: seems to be fine. Are you working on it?
I found out that I have the need to have more than one section in my statusbar, *and* a progressbar in one of those.

I've hacked the progressbar into the existing statusbar (example below) but it it would be nice to have a native interface for this + different statusbar sections. Actually the statusbar should be a proper tGadget methinks.

Extern "win32"
	Function SetParent( hWndChild:Int,hWndNewParent:Int)
End Extern

		window:TGadget=CreateWindow("", 300, 100, 512, 512 )
		progbar:TGadget=CreateProgBar(160,2,260,20,window)	
		
		Local ProgBarHwnd:Int = TWindowsGadget(progbar)._hwnd
		Local StatusHwnd:Int = TWindowsWindow(window)._status			
		
		setParent(ProgBarHwnd,StatusHwnd)
		
		SetGadgetLayout progbar,1,1,1,0




DavidDC(Posted 2008) [#49]
Thanks Seb. I've downloaded but am not quite sure what goes where. Judging by the Module names, I've now got:

C:\Program Files\BlitzMax\mod\MaxGUI.mod\win32maxguiex.mod
C:\Program Files\BlitzMax\mod\MaxGUI.mod\maxgui.mod

C:\Program Files\BlitzMax\mod\brl.mod\maxgui.mod (as usual)

In my main.bmx I've got

Import MaxGUI.Win32MaxGUIEx

So surprise, surprise in comes the error:

Compile Error: Duplicate identifier 'TIconStrip' in modules 'brl.maxgui' and 'maxgui.maxgui'

So clearly something is in the wrong place.

Ideas?


Dreamora(Posted 2008) [#50]
Yeah, thank the sync mod for that ... you shouldn't have the brl one, all maxgui stuff is no in maxgui.XXXX, not brl.xxxguiXXX


DavidDC(Posted 2008) [#51]
Thanks Dreamora - I've got the .ex version running now.

Is it meant to be this slow? I've an app with maybe 50 gadgets in a window and I can see the gadgets draw one by one on dialog open.

I'm also having an issue with treeviews. AddNode returns a correct value?

After encountering a raft of issues, I try switching back to MaxGui.Win32MaxGui and get:

C:/Program Files/BlitzMax/mod/maxgui.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32hwnd.cpp.debug.win32.x86.o)(.text+0x88):win32hwnd.cpp: undefined reference to `brl_maxgui_HotKeyEvent'
C:/Program Files/BlitzMax/mod/maxgui.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32hwnd.cpp.debug.win32.x86.o)(.text+0x406):win32hwnd.cpp: undefined reference to `brl_win32maxgui_EmitWin32OSEvent'
C:/Program Files/BlitzMax/mod/maxgui.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32hwnd.cpp.debug.win32.x86.o)(.text+0x557):win32hwnd.cpp: undefined reference to `brl_win32maxgui_EmitWin32OSEvent'
C:/Program Files/BlitzMax/mod/maxgui.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(event.cpp.debug.win32.x86.o)(.text+0x5):event.cpp: undefined reference to `brl_win32maxgui_PostWin32GuiEvent'
C:/Program Files/BlitzMax/mod/maxgui.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32textarea2.cpp.debug.win32.x86.o)(.text+0x1291):win32textarea2.cpp: undefined reference to `brl_win32maxgui_FilterKey'
C:/Program Files/BlitzMax/mod/maxgui.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32textarea2.cpp.debug.win32.x86.o)(.text+0x12a4):win32textarea2.cpp: undefined reference to `brl_win32maxgui_FilterChar'
C:/Program Files/BlitzMax/mod/maxgui.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32textfield.cpp.debug.win32.x86.o)(.text+0x446):win32textfield.cpp: undefined reference to `brl_win32maxgui_FilterChar'
C:/Program Files/BlitzMax/mod/maxgui.mod/win32maxgui.mod/win32maxgui.debug.win32.x86.a(win32textfield.cpp.debug.win32.x86.o)(.text+0x457):win32textfield.cpp: undefined reference to `brl_win32maxgui_FilterKey'

Oops!

- David


Brucey(Posted 2008) [#52]
I can see the gadgets draw one by one on dialog open.

Cool! MaxGUI bullet time ;-)

the "brl_" seems to imply that your object code thinks it should be linking to something that isn't there, since you also show "maxgui.mod/win32maxgui.mod/..."

I suggest a fresh build of the MaxGUI stuff (if you don't want to rebuild, try deleting .bmx folders and .a files).


skidracer(Posted 2008) [#53]
David the subversion topic warns against mixing syncmods and subversion versions of blitzmax 1.28 modules.

You may be ok if you remove the entire mod/maxgui.mod tree and do another syncmods. You may then need to rebuild all modules and then if your app still fails try disabling quick build also.


DavidDC(Posted 2008) [#54]
Yes thanks Skid, It was very much "one of those days" for me - and all the issues I encountered could well be due to the SVN/syncmods clash. I'll try again with a clean install another time.


SebHoll(Posted 2008) [#55]
For some reason, there is a line missing in TWindowTreeNode.SetText() (win32maxguiex.bmx) which was rendering the method useless.

You may want to replace it with the following so that tree-view nodes can be modified (including the debug tree in the IDE):

	Method SetText(text$)
		Local tv:TVITEMW=New TVITEMW
		tv.mask=TVIF_HANDLE|TVIF_TEXT
		tv.hItem = _item
		If _icon > -1 Then
			tv.mask:|TVIF_IMAGE|TVIF_SELECTEDIMAGE
			tv.iImage=ValidateIcon(_icon)
			tv.iSelectedImage=ValidateIcon(_icon)
		EndIf
		tv.pszText=text.ToWString()
		SendMessageW(_tree,TVM_SETITEMW,0,Int Byte Ptr tv)
		MemFree tv.pszText
	EndMethod
Thought I'd post it here until BRL upload the fix to the SVN version!


Difference(Posted 2008) [#56]
I get real bad flickering on the tabber surface when rezising tabbers. What can be done?

The MaxIde latest(SVN revision 40 and MaxGiu SVN revision 25)has it too in the treeview, though it seems somewhat cloacked beacuse of background color is the same as the flickering surface.

[EDIT] the "createtabber.bmx" sample shows the flickering, but only on the tabs.
[EDIT AGAIN] Comment out:
'SetPanelColor document[0],255,200,200
'SetPanelColor document[1],200,255,200
'SetPanelColor document[2],200,200,255

to see the flickering


SebHoll(Posted 2008) [#57]
I get real bad flickering on the tabber surface when rezising tabbers. What can be done?


Are you using MaxGUI.Win32MaxGUI or MaxGUI.Win32MaxGUIEx?


Difference(Posted 2008) [#58]
MaxGUI.Win32MaxGUIEx. Can't use the other one, I think I removed it due to conflicts with the SVN version?
I'll test on some other computers to see if it's my GFX driver (Asus 9600XT, ATI drivers)


Difference(Posted 2008) [#59]
.


Grisu(Posted 2008) [#60]
.?


SebHoll(Posted 2008) [#61]
Peter:
MaxGUI.Win32MaxGUIEx. Can't use the other one, I think I removed it due to conflicts with the SVN version?

It's worth noting, that the old BRL.CocoaMaxGUI, BRL.Win32MaxGUI, BRL.FLTKMaxGUI and BRL.MaxGUI modules should be deleted manually from your BlitzMax\mod\brl.mod\ folder if you are using the new MaxGUI.etc series of modules from the SVN server.

If you have this arrangement, and you've rebuilt modules, please could you post the version of MaxGUI.Win32MaxGUIEx you are using (just to be sure) and the exact code you are having trouble with along with instructions on how to reproduce the bug...

Thanks!


Difference(Posted 2008) [#62]
@SebHoll
All modules was already deleted.

MaxGui SVN revision 25
Module MaxGUI.Win32MaxGUIEx
ModuleInfo "Version: 0.42"

Resizeing the window in the code below causes the main area of the tabber to flicker (vertical sync flickering)

If the panes are colored, the flickering is limited to only the tabs in the top


[EDIT] changed include to win32maxguiex to reflect actual test as pointed out below


SebHoll(Posted 2008) [#63]
I can't reproduce the bug here, but I should point out that in the above example you are importing the old GUI module (perhaps, by mistake) MaxGUI.Win32MaxGUI as oppose to the newer MaxGUI.Win32MaxGUIEx.

Some improvements were added to the new module to reduce flickering when resizing gadgets, but as the Windows GUI doesn't double buffer most controls, flicker can never be eliminated completely (short of over-riding Windows' WM_PAINT message and drawing the control yourself).

Edit: Peter, you have e-mail!


Difference(Posted 2008) [#64]
Ok, thanks for looking into it.
I'll see if I can find suitable workarunds if this persists.


Difference(Posted 2008) [#65]
Again , thx's for taking an interest to this. Here's what I've come up with. This limits the flicker to the tabs.



Retimer(Posted 2008) [#66]
Is anyone else getting memory leaks with Win32MaxGUIEx + freegadget?

When I don't declare
Framework maxgui.win32maxguiex


and free my gadgets, the memory clears. When I do declare win32maxguiex, the gadgets seem to stay in memory even after freeing them.

SuperStrict
?win32
Framework maxgui.win32maxguiex
?

Import brl.eventqueue
Import brl.timer
Import brl.glmax2d

Global TestWindow:tgadget = CreateWindow("???",50,50,300,300,,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS)
Global Canvas:tgadget = CreateCanvas(0,0,300,300,TestWindow)

'This is the popup window

Global NewWindow:tgadget
Global NewList:tgadget
NewWindow = CreateWindow("Popup",150,150,100,100,,Window_TITLEBAR)
NewList = CreateListBox(0,0,100,100,NewWindow)



CreateTimer 60
Repeat
	WaitEvent()
	Select EventID()
		Case event_windowclose
			If EventSource() = TestWindow
				End
			Else
				FreeGadget(newlist)
				FreeGadget NewWindow
				NewWindow = CreateWindow("Popup",150,150,100,100,,Window_TITLEBAR)
				NewList = CreateListBox(0,0,100,100,NewWindow)
			End If
		Case event_timertick
			SetGraphics(CanvasGraphics(canvas))
			Cls
			DrawText(GCMemAlloced(),50,50)
			Flip
	End Select
	GCCollect()
Forever


When you close the window, the gadgets are freed then recreated. I'm probobly missing something here (fairly new to bmax), but shouldn't the memory remain the same?


SebHoll(Posted 2008) [#67]
Here's a nice easy fix for you, replace the TWindowsGadget.Free() method in win32maxguiex.bmx with...

	Method Free()
		If _tooltips Then DestroyWindow _tooltips;TWindowsGUIDriver.RemoveHwnd( _tooltips);_tooltips=0
		If _hwnd DestroyWindow _hwnd;TWindowsGUIDriver.RemoveHwnd( _hwnd);TWindowsGUIDriver.RemoveHwnd( _hwndclient);_hwnd=0;_hwndclient=0
		_SetParent Null
	EndMethod	
You may also want to replace TWindowsTreeNode.Free() with the following also:

	Method Free()
		If _item SendMessageW _tree,TVM_DELETEITEM,0,_item
		_item=0
		
		Local tmpParentHasKids = SendMessageW(_tree, TVM_GETNEXTITEM, TVGN_CHILD, _parent._item)
		If Not tmpParentHasKids Then _parent.RedrawNode()
		_parent = Null;_tree = 0;_SetParent Null
	EndMethod
Let me know how you get on, and I'll pester Skid to update the SVN version. Oh, and don't forget to build modules after you apply the tweak. ;-)


Retimer(Posted 2008) [#68]
looks like that worked. Thanks!


SebHoll(Posted 2008) [#69]
Just letting everyone know that a new version of MaxGUI.Win32MaxGUIEx (v0.44) is now up on SVN and it includes the following fixes:

ModuleInfo "History: 0.44 Release"
ModuleInfo "History: Changed tabber tool-tip handling to use TCM_HITTEST message."
ModuleInfo "History: Fixed tab control up-down arrows being unresponsive."
ModuleInfo "History: 0.43 Release"
ModuleInfo "History: Fixed SetGadgetText() with treeview node."
ModuleInfo "History: Fixed FreeGadget() memory leak by adding _SetParent Null."
ModuleInfo "History: Fixed Windows Classic panel redraw issues."

There is also a new version of MaxGUI.Drivers which simply adds compiler directives around the module imports, also available from SVN.


Brucey(Posted 2008) [#70]
So, what's your ETA on getting up to the old GUI level of functionality? :-)

ie. where I can drop it into the IDE and expect it to work as well as it currently does.


SebHoll(Posted 2008) [#71]
So, what's your ETA on getting up to the old GUI level of functionality? :-)

ie. where I can drop it into the IDE and expect it to work as well as it currently does.

You should be able to do this now... In fact, I think it works better than the old module, but each to their own I suppose...

It has replaced the old module as the default Windows MaxGUI driver on SVN. ;-)


JoshK(Posted 2008) [#72]
What the hell is SVN?


xlsior(Posted 2008) [#73]
What the hell is SVN?


Subversion.

It's a version-controlled repository that can be used to distribute software. BRL has been using subversion to spread out the latest updates, and rarely use syncmods anymore it seems.

Might be nice if you want the very latest versions of everything, but I guess you also risk breaking things easier since they are development builds.

there's instructions on the forum somewhoere on how to set up SVN and connect to BRL to have it download the updates if you're interested. (I never did set it up myself, syncmods seemed much more convenient to me)