Page 5 of 15

Re: EditorFactory - Module for object management in a Canvas

Posted: Mon Feb 15, 2021 4:47 pm
by ShadowStorm
ChrisR, please describe what you want with explicit images, because I don't really understand what you want.
Well it was not planned all this and it delays us for the rest but ok why not :)
I think we need to simplify all this.

Re: EditorFactory - Module for object management in a Canvas

Posted: Sun Feb 21, 2021 6:15 pm
by STARGÅTE
Any comments to the second part of my last post? viewtopic.php?p=565760#p565760
STARGÅTE wrote:As I can see, you want to use the images of PB gadget as object images, but for now you have no access to interact with this images (like clicking on the scroll bar or on a panel tab). Up to now I'm not sure how I/we can handle this without program the whole gadget itself, which is not the purpose of this include.
Would it help if I include an additional callback, which is called during the event handling? In this callback you would then have access to the local mouse cursor position and mouse events to check for clicks and hovers.
But how do you know the metrics/dimensions of the scrollbar or a tab in a panel gadget?
@ChrisR: In case of a panel gadget: Is Panel_ItemWidth, Panel_ItemHeight needed? Isn't it just parent width - 3 and parent height - 25 ?
Defining the frame properties during adding is a good idea. However, you need to widths and heights right?
The view port size (with out scrollbars) and the inner frame size?

Re: EditorFactory - Module for object management in a Canvas

Posted: Wed Feb 24, 2021 2:27 am
by ChrisR
With a little delay,
For the Panel, I use
. the Left border and GetGadgetAttribute(Gadget, #PB_Panel_ItemWidth)
. the Top border and GetGadgetAttribute(Gadget, #PB_Panel_ItemHeight)

It might be useful if a frame could be defined with (Left OffSet, Top OffSet, InnerWidth, InnerHeight)
To define the Frame offset and also the child boundary from iX=0, iY=0 to the Inner size.

Image

Same for the ScrollAreaGadget and then you have to play with SetObjectFrameClipping according to GadgetWidth(Height) and if Scroll Bar are displayed or not.

Code: Select all

If (GetWindowLongPtr_(GadgetID(Gadget), #GWL_STYLE) & #WS_VSCROLL) => GetSystemMetrics_(#SM_CXVSCROLL)
If (GetWindowLongPtr_(GadgetID(Gadget), #GWL_STYLE) & #WM_HSCROLL) => GetSystemMetrics_(#SM_CYHSCROLL)
Otherwise, I don't know what to think about your additional callback idea.
It would probably be a bit complicated to use the mouse position and all the metrics to simulate the clicks and movement of the Scroll Bar.
It is much easier by using AddObjectHandle to add the arrows.

Re: EditorFactory - Module for object management in a Canvas

Posted: Thu Mar 04, 2021 9:03 pm
by STARGÅTE
For the PanelGadget the definition of (Left OffSet, Top OffSet, InnerWidth, InnerHeight) and you picture is clear,
because in a PanelGadget the inner area is not smaller or larger, meaning no scrollbars included.
But in case of a ScrollAreaGadget you have on one hand the offset and inner size (the visible area) and on the other hand the content offset and content area size.

Here the image what I mean:

Image

So in principal you would need:
AddObjectFrame(Object, FrameIndex, ViewBoxX, ViewBoxY, ViewBoxWidth, ViewBoxHeight, InnerAreaX, InnerAreaY, InnerAreaWidth, InnerAreaHeight).

In case of a PanelGadget:
ViewBoxX = 3, ViewBoxY = 25, ViewBoxWidth = "#PB_Panel_ItemWidth", and ViewBoxHeight = "#PB_Panel_ItemHeight"
InnerAreaX = 0, InnerAreaY = 0, InnerAreaWidth = ViewBoxWidth, and InnerAreaHeight = ViewBoxWidth
Should it be then possible to move an inner object over the border?

In case of a ScrollAreaGadget:
ViewBoxX = 3, ViewBoxY = 3, ViewBoxWidth = ..., and ViewBoxHeight = ...
InnerAreaX = "#PB_ScrollArea_X", InnerAreaY = "#PB_ScrollArea_Y", InnerAreaWidth = "#PB_ScrollArea_InnerWidth", and InnerAreaHeight = "#PB_ScrollArea_InnerHeight"
Same here: should it be then possible to move an inner object over this inner size border, or should it be blocked by the boundary?

Re: EditorFactory - Module for object management in a Canvas

Posted: Thu Mar 04, 2021 11:20 pm
by Paul
@STARGÅTE ... this is off topic ;)
Not sure if anyone else has this problem but none of the images you link to are viewable here. Even your avatar image is a broken link. Maybe it has to do with the forum being https and your links are http ??

Re: EditorFactory - Module for object management in a Canvas

Posted: Fri Mar 05, 2021 12:31 am
by STARGÅTE
Good point Paul. I fixed these issues now. Did it work for you?

Re: EditorFactory - Module for object management in a Canvas

Posted: Fri Mar 05, 2021 12:34 am
by Axolotl
sorry for jumping in. Everything looks perfect here.

Re: EditorFactory - Module for object management in a Canvas

Posted: Fri Mar 05, 2021 4:18 am
by Paul
STARGÅTE wrote:Good point Paul. I fixed these issues now. Did it work for you?
Perfect! :D

Re: EditorFactory - Module for object management in a Canvas

Posted: Mon Mar 15, 2021 8:50 pm
by ShadowStorm
Hello, could you answer to Stargate, the project is at the stop because it has no answer :( , we take delay, thank you :wink:

Re: EditorFactory - Module for object management in a Canvas

Posted: Mon Mar 15, 2021 10:30 pm
by ChrisR
STARGÅTE wrote:Should it be then possible to move an inner object over the border?

Same here: should it be then possible to move an inner object over this inner size border, or should it be blocked by the boundary?
For my part, I do not have the answer and Stargate knows better.

For me, an inner object should be blocked by its border, its boundary
But maybe I am wrong, Windows allows to go beyond the borders. In this case, it displays only the part of the object inside the internal area (#PB_Panel_ItemWidth(Height) for a panel). The other part is cut out, not drawn as it is done by using SetObjectFrameClipping() in Editor Factory.
for a designer, I would tend to say that it would be better to respect the borders that serve as boundaries.

Code: Select all

OpenWindow(0, 0, 0, 320, 240, "", #PB_Window_SystemMenu)
PanelGadget(0, 0, 0, 320, 240)
AddGadgetItem(0, -1, "Tab 1")
ButtonGadget(1, -20, -20, 100, 40, "MyButton1")
ButtonGadget(2, 240, 190, 100, 40, "MyButton2")
CloseGadgetList()

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: EditorFactory - Module for object management in a Canvas

Posted: Mon Mar 15, 2021 11:06 pm
by STARGÅTE
Ok, but you are fine with such definition?

Code: Select all

AddObjectFrame(Object, FrameIndex, ViewBoxX, ViewBoxY, ViewBoxWidth, ViewBoxHeight, InnerAreaX, InnerAreaY, InnerAreaWidth, InnerAreaHeight).
However the last parameters are optionally like:

Code: Select all

AddObjectFrame(Object[, FrameIndex[, ViewBoxX, ViewBoxY, ViewBoxWidth, ViewBoxHeight[, InnerAreaX, InnerAreaY, InnerAreaWidth, InnerAreaHeight]]]).
meaning:
- if no InnerArea is defined, it has the size of the parent object
- if no ViewBox is defined, is become the size of the parent object.
- if no FrameIndex is defined, a frame at the end is added.

Re: EditorFactory - Module for object management in a Canvas

Posted: Tue Mar 16, 2021 12:28 am
by ChrisR
That sounds good to me except for InnerAreaX(Y) which I don't really see the use for Windows controls. It is, in this case, the same as ViewBoxX(Y)

Code: Select all

AddObjectFrame(Object, FrameIndex [, ViewBoxX, ViewBoxY, ViewBoxWidth, ViewBoxHeight [, InnerAreaWidth, InnerAreaHeight]])
But it may be a good to keep these 2 values for other cases, Splitter for example or for other uses than in a Designer.
So it looks good with your definition

Code: Select all

AddObjectFrame(Object[, FrameIndex[, ViewBoxX, ViewBoxY, ViewBoxWidth, ViewBoxHeight[, InnerAreaX, InnerAreaY, InnerAreaWidth, InnerAreaHeight]]])
It's in conditional, I'm not sure that I'm the right guy to answer, there are a lot of guys much more experienced than me around, starting with you, of course :wink:

Re: EditorFactory - Module for object management in a Canvas

Posted: Tue Mar 16, 2021 12:46 am
by ChrisR
Unrelated!
An idea to mature for the future of your module, if you wish, would be to have the borders of one object that serve as boundaries for other objects with the overlap prohibited.
I am thinking for example of kitchen design tools

Re: EditorFactory - Module for object management in a Canvas

Posted: Tue Mar 16, 2021 1:32 am
by STARGÅTE
Now I can hear ShadowStorm laughing, because he had also suggested it during a discussion with me.
I will go forward and finalize the frame stuff first.

Thank for your contribution.

Re: EditorFactory - Module for object management in a Canvas

Posted: Tue Mar 16, 2021 2:39 am
by ShadowStorm
ChrisR wrote:Unrelated!
An idea to mature for the future of your module, if you wish, would be to have the borders of one object that serve as boundaries for other objects with the overlap prohibited.
I am thinking for example of kitchen design tools
Indeed, I had asked this too.

But even better, decide with which object it can or cannot collide (overlap).

For example, Object A can't overlap with Object B.
Of course Object B can't overlap Object A either.

And I would also have liked to set up a system of magnetization of objects.

For example when an object approaches another, from a certain distance (configurable), the two objects are attracted (stuck), like magnets.

We can imagine for example to make puzzles or then graphic elements to make for example graphic language, in the style of "Scratch".

I also had the idea to be able to link objects with the "links", in this kind of way:
https://www.purebasic.fr/french/viewtop ... =3&t=17751

But there, it may become a little more complicated, to see.
There are still a lot of things to set up.

In short, beautiful things to come if Stargate wants it.