WildByDesign Posted Monday at 02:01 PM Posted Monday at 02:01 PM 20 minutes ago, MattyD said: And resizing the window actually works remarkably well. I guess I was expecting some flicker or something- so that was a pleasant surprise! That's quite beautiful. You are making excellent progress so far. I haven't tested this in the last few days but I'm definitely more inspired now to try some things with it later today. How is the performance of the UI loading? The reason why I ask is because a lot of Microsoft's own examples with WinUI3 are quite sluggish. Yet, I have also seen many examples from other developers which are fast and snappy. How do you handle applying DPI scaling? I'm just not sure if the WinUI3 / WinRT stuff automatically applies DPI scaling by default or if we would specify the DPI scaling as we normally would in AutoIt.
MattyD Posted Monday at 02:42 PM Author Posted Monday at 02:42 PM Thanks mate, we'll have to credit whoever came up with the design at Microsoft though! 18 minutes ago, WildByDesign said: How is the performance of the UI loading? This is honestly fine, but we're not exactly asking much of the runtime either at this point in time! Au3check can grind a bit when you really start pushing the #include file count. But for what I'm doing at the moment its OK. 25 minutes ago, WildByDesign said: How do you handle applying DPI scaling? I haven't looked at this at all sorry! WildByDesign 1
MattyD Posted Wednesday at 07:47 AM Author Posted Wednesday at 07:47 AM (edited) This is the same example - but I'm playing around with adding another layer of functions on top of the interface libraries. It should make building GUIs quite a bit simpler, and introduce some semblance of resource management. At this stage its just a rough proof of concept, so I'm not worried about naming conventions etc, or any mistakes in these functions. They'll all probably be rewritten anyway! So anyway, as an example: I'm now doing this to add rows and columns to the grid. ;Params - $pGrid, $fValue, $vUnit ("Auto", "Pixel" or "Star") ;$vUnit can also be the enum in its numeric form. (Microsoft.UI.Xaml.GridUnitType) GridAddRow($pGrid, 2, "Star") GridAddRow($pGrid, 1, "Star") GridAddColumn($pGrid, 3, "Star") GridAddColumn($pGrid, 5, "Star") And the underlying func. Func GridAddColumn($pGrid, $fWidth = 1, $vUnit = "Star") _WinRT_SwitchInterface($pGrid, $sIID_IGrid) If @error Then Return SetError(@error, @extended, False) Local $tGridLen = DllStructCreate("align 4;double Value;ulong GridUnitType") $tGridLen.Value = $fWidth $tGridLen.GridUnitType = IsString($vUnit) ? $mGridUnitType[$vUnit] : $vUnit Local $pColDef, $pColDefs = IGrid_GetColumnDefinitions($pGrid) $pColDef = _WinRT_ActivateInstance("Microsoft.UI.Xaml.Controls.ColumnDefinition") _WinRT_SwitchInterface($pColDef, $sIID_IColumnDefinition) IRowDefinition_SetHeight($pColDef, $tGridLen) Local $iError = @error If Not $iError Then IVector_Append($pColDefs, $pColDef) IUnknown_Release($pColDef) IUnknown_Release($pColDefs) Return SetError($iError, 0, $iError = $S_OK) EndFunc ;==>GridAddColumn Most funcs that accept an object will start with a SwitchInterface() - this serves 2 purposes: in your main script you don't need to bother about setting the correct interface on the object. and also if you feed the func an invalid pointer (to the wrong object for eg.), it should gracefully fail. Factories and other supporting objects used in these funcs are all released before returning. This is probably not be the most efficient thing to do if you're creating a bunch of instances of something - but it does mean you're cleaning up after yourself as you go. I'm getting way ahead of myself - but this new layer wouldn't be a comprehensive wrapper. It'd probably just some basic/common functionality to improve quality of life. I figure people can always jump down to the interface libraries if need be. Whether this will form part of an "official" release I don't know (if I ever get my act together!) - but I think building a full project without anything would just be downright tedious... And hey, if anyone else wants write/drive some of it I won't be complaining!!! WindowTest Grid.zip Edited Wednesday at 07:50 AM by MattyD argumentum and WildByDesign 2
argumentum Posted Wednesday at 08:33 AM Posted Wednesday at 08:33 AM (edited) ... #AutoIt3Wrapper_UseX64=Y #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 If Not @AutoItX64 And Not @Compiled Then ShellExecute(StringTrimRight(@AutoItExe, 4) & "_x64.exe", '"' & @ScriptFullPath & '"') Exit EndIf #include <GUIConstants.au3> ... It asked me to GetRuntime() but I installed it yesterday so, the above is a good solution for those not in SciTE, just click-clicking the file from explorer Edited Wednesday at 08:35 AM by argumentum MattyD and WildByDesign 1 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now