Forum Replies Created
-
AuthorPosts
-
amckinlay
KeymasterPS. Part of the reason for the WndPane might have been to get the tab order.
amckinlay
KeymasterNice idea! I’ll try it.
Note: When you have multiple monitors, some of them can be at negative coordinates (but that is screen coordinates, not window coordinates)
My modifications were not a good solution – they cause problems with some things e.g. ListView in QueryView
Technically, suneido/stdlib isn’t using MFC, it is just using the Win32 api (like MFC does).
It would be an interesting project to rewrite Suneido in .NET, but it took me a couple of years to do the Java rewrite, and .NET would probably be comparable. Maybe there is some way to allow the current suneido.exe to call .NET code (similiar to the current dll interface used to call Win32 api’s).
amckinlay
KeymasterThat makes sense.
When it creates the control (via Hwnd.CreateWindow) it does not know the final size or position – this is determined by the layout Recalc
So it creates it at an arbitrary position and size and then the first Resize adjusts the position and size.
This works fine when you are constructing the whole window at once because you only see the final result. But not so good with dynamically creating controls.
I’m still not sure why it’s actually getting painted with the original (wrong) position/size. I thought painting wasn’t done till you returned to the message loop and processed paint messages. Unless you call UpdateWindow, but I do not think it is getting called.
Maybe what we should be doing is creating the controls without WS.VISIBLE and then making them visible after the first Resize (SetWindowPos)
I made this simple test:
Window(Controller
{
Xmin: 800
Ymin: 600
Controls: (Vert (Button Add))
On_Add()
{ .Vert.Insert(.Vert.Tally(), #(Field)) }
})It flickers. If I add this in Hwnd.CreateWindow just before CreateWindowEx
.show = (style & WS.VISIBLE) is WS.VISIBLE
style &= ~WS.VISIBLEand add this in Hwnd.Resize just before SetWindowPos
if .show
{
.SetVisible(true)
.show = false
}Now my simple test does not flicker ๐ But RepeatControl still flickers ๐ Maybe something to do with it using WndPaneControl ?
WARNING: Be careful modifying Hwnd or similar code. For example, if you make a syntax error you can crash the Suneido UI. I usually Dump() just before making these kinds of changes. Then if you crash you can restore with suneido -load
amckinlay
KeymasterI agree the flickering is annoying. I guess I have just got used to it!
I think this is coming from the .WindowRefresh() in Group (parent of Vert and Horz) Insert and Remove
Because of stretchable controls and fill, adding or removing (or resizing) a control can cause non-local changes, so the layout for the entire window has to be recalculated. Of course, most of the time only certain parts of the window actually change.
WindowBase.Refresh does combine multiple refreshes to reduce the flickering.
The refresh ends up calling Resize on each control which usually ends up in Hwnd.Resize that calls SetWindowPos. But it still flickers even if I change this to not call SetWindowPos if the size is the same.
Now that I look at it, I’m not sure where the flickering is actually coming from.
If you are using FieldControl is has a .Repaint() in .SetBgndColor which is probably unnecessary when called by New. But commenting it out doesn’t help.
The SWP.NOCOPYBITS in Hwnd.Resize is suspicious, but again commenting it out doesn’t help.
The CS.REDRAW in the Window class definitions in Init also caught my eye, but removing it didn’t help.
It seems like something is erasing and redrawing the whole window, but I can’t find where that would be coming from.
Sorry, I am stumped. I wrote most of this code, but it was a long time ago!
Anyone else have any ideas?
amckinlay
KeymasterTry this:
http://archives.suneido.com/suneido-forum-archive.zip (8 mb)
Note: It doesn’t include any associated “attachments”.
amckinlay
KeymasterI think you need to add a CanvasImage. Image is a lower level built-in class for loading image files.
Canvas was written for DrawControl (SuneiDraw). You can look at the DrawControl code for usage.
Is there a particular reason you are using Canvas? You’re welcome to use it, but it’s not the normal user interface for Suneido. (We don’t use it in any of our applications.)
amckinlay
KeymasterYeah, I can see your point.
Opening in the current tab would be more like a web browser.
Currently it works more like a text editor where each “file” is opened in a new tab. For example, this is how Eclipse works.
But unlike a text editor, Library View saves as soon as you leave a tab, so you can’t have multiple tabs with unsaved changes.
One option would be to only keep N tabs open and automatically close the least recently used one.
I’ll think about it. Thanks for the suggestion.
amckinlay
KeymasterSorry, my mistake.
Here’s what I ran from the WorkSpace:
w = Window(#(Vert (Canvas)))
w.Vert.CanvasI missed that you’re using a Controller, so it becomes:
w = Window(Controller { Controls: (Vert (Static hello)) })
w.Ctrl.Vert.Canvas(the top level control in a window can be referenced as Ctrl)
You can always do Inspect(w) to see what you’re getting.
It is often better is to use FindControl
w.FindControl(‘Canvas’)
This will search through the control tree for a control with that name, so it won’t break when you change your layout.
If you have multiple controls of the same type you need to give them unique names:
(Vert (Field name: one) (Field name: two))
amckinlay
KeymasterI think we converted the old forum to static pages, if so, we should be able to zip up the contents for you.
I’ll look into it.
amckinlay
KeymasterYou need to keep a reference to the Window.
w = Window(…
Then you can do:
w.Vert.Canvas.AddItem(…
Or if it’s just setup stuff, you can do it in a New method in the Controller.
I’m not sure how much Canvas has been used lately so let me know if there are any problems.
amckinlay
KeymasterThanks ๐
The jSuneido source code is available from the Mercurial repository on SourceForge.
http://sourceforge.net/projects/suneido/develop
I will include a pre-built jar file in the next download.
amckinlay
KeymasterGlad you got it figured out.
Those “obvious” little things will get you every time!
There should probably be validation in Library View for capitalized names.
amckinlay
KeymasterYes, Browse is not good for large data ๐
To display (but not edit) large amounts of data you can use ListView. This is what QueryView uses.
One option would be to add editing to ListView
It should be easy to add an option to copy a record.
What do you mean by “entering the column”? You can tab through the columns.
amckinlay
KeymasterSorry, this is not implemented.
If I remember correctly, COM events are like callbacks. It could be implemented something like the callbacks in the DLL interface. But I think you need to implement a COM interface, not just a single function, so it is more complicated.
amckinlay
KeymasterI posted the latest jar on SourceForge:
http://sourceforge.net/projects/suneido/files/Snapshots/jsuneido20101121.jar/download
I have attached a dump of the latest stdlib, you should be able to load this with:
java -jar jsuneido.jar -load stdlib.su
You can use -repl to get a simple command line interface to jsuneido
You may want to specify -ea (enable asserts) and -Xmx256m (or larger – maximum heap size), for example:
java -ea -Xmx256m -jar jsuneido.jar -repl
I use a batch file called jsuneido.bat to simplify this:
@java -ea -Xmx256m -jar jsuneido.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
Note: To work with the suneido.exe client you either need to specify -iv (ignore version) to suneido.exe or to specify -i “…” to jsuneido.jar to “impersonate” a specific version
-
AuthorPosts