It is currently Tue Feb 18, 2020 4:08 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 154 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 11  Next
Author Message
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Tue May 02, 2017 9:46 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 122
Location: France
Hi Little_man
Can you explain a little more, it is really worrying for the concept if it does not work for all.
Edit:
Little_man wrote:
Problem solved

Removed and reinstalled purebasic 5.60.
OK Thanks :)

I had prepared this for testing, a simple example to move a button and display a grid, based on same concept (canvas + Gadget in overlay).
Code:
Enumeration FormWindow
  #WinMain
EndEnumeration

Enumeration FormGadget
  #GridCanvas
  #Text
  #Canvas
  #Button
EndEnumeration

Declare OpenMainWindow(x = 0, y = 0, width = 340, height = 240)
Declare ShowGrid()
Declare MouseEvent()

Procedure ShowGrid()
  Protected X.i, Y.i
  Static GridDisplayed.b
 
  Select EventType()
    Case #PB_EventType_LeftButtonDown
      If StartDrawing(CanvasOutput(#GridCanvas))
        If GridDisplayed = #False
          Box(0, 0, OutputWidth(), OutputHeight(), $EBE6E1)
          For X = 0 To OutputWidth()
            For Y = 0 To OutputHeight()
              Line(0, Y, OutputWidth(), 1, $CCCCCC)
              Y+19
            Next
            Line(X, 0, 1, OutputHeight(), $CCCCCC)
            X+19
          Next
          GridDisplayed = #True
        Else
          Box(0, 0, OutputWidth(), OutputHeight(), $F0F0F0)
          GridDisplayed = #False
        EndIf
       StopDrawing()
      EndIf
       
  EndSelect
EndProcedure

Procedure MouseEvent()
  Static ButtonSelected.b, OffsetX, OffsetY
 
  Select EventType()
    Case #PB_EventType_LeftButtonDown
      ButtonSelected = #True
      OffsetX = GetGadgetAttribute(#Canvas, #PB_Canvas_MouseX)
      OffsetY = GetGadgetAttribute(#Canvas, #PB_Canvas_MouseY)
     
    Case #PB_EventType_LeftButtonUp
      ButtonSelected = #False
     
    Case #PB_EventType_MouseMove
      If ButtonSelected
        ResizeGadget(#Canvas, WindowMouseX(#WinMain)-OffsetX, WindowMouseY(#WinMain)-OffsetY ,#PB_Ignore, #PB_Ignore)
        ResizeGadget(#Button, WindowMouseX(#WinMain)-OffsetX, WindowMouseY(#WinMain)-OffsetY ,#PB_Ignore, #PB_Ignore)
      EndIf

   EndSelect
EndProcedure
       
Procedure OpenMainWindow(x = 0, y = 0, width = 340, height = 240)
  OpenWindow(#WinMain, x, y, width, height, "Click and Move Button + Grid", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
  CanvasGadget(#GridCanvas, x, y, width, height, #PB_Canvas_Container)
  If StartDrawing(CanvasOutput(#GridCanvas))
    Box(0, 0, OutputWidth(), OutputHeight(), $F0F0F0)
    StopDrawing()
  EndIf
  TextGadget(#Text, 100, 220, 140, 20, "Click to show/hide the grid", #PB_Text_Center)
  CanvasGadget(#Canvas, 100, 80, 140, 60)
  SetGadgetAttribute(#Canvas, #PB_Canvas_Cursor, #PB_Cursor_Arrows)
  ButtonGadget(#Button, 100, 80, 140, 60, "Click and Move")
  CompilerIf #PB_Compiler_OS = #PB_OS_MacOS : DisableGadget(#Button, #True) : EndIf
EndProcedure

OpenMainWindow()
BindGadgetEvent(#GridCanvas, @ShowGrid(), #PB_EventType_LeftButtonDown)
BindGadgetEvent(#Canvas, @MouseEvent(), #PB_EventType_LeftButtonDown)
BindGadgetEvent(#Canvas, @MouseEvent(), #PB_EventType_LeftButtonUp)
BindGadgetEvent(#Canvas, @MouseEvent(), #PB_EventType_MouseMove)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow


Edit: Disable button Gadget for OSX (see below)


Last edited by ChrisR on Wed May 03, 2017 3:09 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Wed May 03, 2017 9:20 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Sep 10, 2012 10:41 am
Posts: 128
Location: Savoie
The click and move doesn't work on OS X...

_________________
MacBook Pro 13" Retina - 16 Gb - OSX 10.14 - Iphone X - iPad at home
...and unfortunately... Windows at work...


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Wed May 03, 2017 11:05 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 122
Location: France
Bonjour Mindphazer,
Sadly, I do not have a Mac to test.
I have seen some tuto to install an OSX eval in VMware, I have to look at.
Does anyone have a trick ?

I was able to test it quickly, a little while ago on the PC of an uncle at a family celebration.
And indeed, unlike Windows and Linux, the Gadgets remain active over the canvas and thus we can not directly select them.
However, in my quick test, it was possible to select and move the gadgets using the border. Is it still the case ?
For Mac, I enlarged the border from 1px to 3px for that but it's not the best.

A basic idea, can you do a quick test by adding in CreateGadgets Procedure
Code:
If DrawGadget = #False : DisableGadget(IdGadget, #True) : EndIf
Just before the comment
Code:
;Save gadget information in the gadget List
To see!


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Wed May 03, 2017 1:11 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Sep 10, 2012 10:41 am
Posts: 128
Location: Savoie
The click & move doesn't work on your example code above

In VD, it's still possible to select a gadget using its border.
I have tried to add the line in the procedure, but Drawgadget is not declared

_________________
MacBook Pro 13" Retina - 16 Gb - OSX 10.14 - Iphone X - iPad at home
...and unfortunately... Windows at work...


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Wed May 03, 2017 1:50 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 122
Location: France
Ha, OK, in the above code example
For OSX, I think you should Disable the Button Gadget:
Code:
ButtonGadget(#Button, 100, 80, 140, 60, "Click and Move") : DisableGadget(#Button, #True)

For the line to add to sweetyvd.pb, I guess you did not put it at the right place,
Line 689 in latest github release, DrawGadget variable exists there
Code:
          If Model <> "TabBarGadget" And DrawGadget = #False : SetGadgetData(IdGadget, CountGadgets) : EndIf   ;Add Gadget Counter to Gadget Data
         
          ;Save gadget information in the gadget List
==>
Code:
          If Model <> "TabBarGadget" And DrawGadget = #False : SetGadgetData(IdGadget, CountGadgets) : EndIf   ;Add Gadget Counter to Gadget Data
          If DrawGadget = #False : DisableGadget(IdGadget, #True) : EndIf   ;<==
          ;Save gadget information in the gadget List


Congratulation for your next post the 100th :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Wed May 03, 2017 2:25 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Sep 10, 2012 10:41 am
Posts: 128
Location: Savoie
ChrisR wrote:
For OSX, I think you should Disable the Button Gadget:
Code:
ButtonGadget(#Button, 100, 80, 140, 60, "Click and Move") : DisableGadget(#Button, #True)

Works better !
ChrisR wrote:
For the line to add to sweetyvd.pb, I guess you did not put it at the right place,
Line 689 in latest github release, DrawGadget variable exists there
Code:
          If Model <> "TabBarGadget" And DrawGadget = #False : SetGadgetData(IdGadget, CountGadgets) : EndIf   ;Add Gadget Counter to Gadget Data
         
          ;Save gadget information in the gadget List
==>
Code:
          If Model <> "TabBarGadget" And DrawGadget = #False : SetGadgetData(IdGadget, CountGadgets) : EndIf   ;Add Gadget Counter to Gadget Data
          If DrawGadget = #False : DisableGadget(IdGadget, #True) : EndIf   ;<==
          ;Save gadget information in the gadget List

Oooops ! My bad, i didn't have the last version !
Now the gadget can be moved wherever it is clicked
Unfortunately, drag'n'drop still doesn't work on OSX, but it's not your fault !

ChrisR wrote:
Congratulation for your next post the 100th :wink:

Hé hé thank you ! :wink:

_________________
MacBook Pro 13" Retina - 16 Gb - OSX 10.14 - Iphone X - iPad at home
...and unfortunately... Windows at work...


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Wed May 03, 2017 3:06 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 122
Location: France
Mindphazer wrote:
ChrisR wrote:
Now the gadget can be moved wherever it is clicked

Great, thanks Mindphazer for the test :)
I will modify accordingly for OS X.


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Wed May 03, 2017 3:19 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Sep 10, 2012 10:41 am
Posts: 128
Location: Savoie
ChrisR wrote:
Great, thanks Mindphazer for the test :)
I will modify accordingly for OS X.

You're welcome !!
I'd be glad to keep on testing further versions

_________________
MacBook Pro 13" Retina - 16 Gb - OSX 10.14 - Iphone X - iPad at home
...and unfortunately... Windows at work...


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Wed May 03, 2017 11:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Feb 01, 2012 3:30 pm
Posts: 761
Location: Nottinghamshire UK
Hi ChrisR Just downloaded 1.8.0 Again have`nt had much time :( to analyse your code but I have adapted CodeCreate() to my personel preferences ie. i,s,b,w..... prefixes and postfixes .i .s etc for variables type. Removed declare procedure() as not needed unless procedure replaced after procedure call and you code with that paradigm. I was also thinking about a adding StringGadget() and checkBoxGadget() for declaring variable prefix and postfix respectively.

Found a drawing glitch in dragging IPGadget() as below, also just checked v1.6.0 with the same effect.

Zebuddi. :)

Image
Image

_________________
malleo, caput, bang. Ego, comprehendunt in tempore


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Thu May 04, 2017 5:54 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 122
Location: France
Hi Zebuddi,
With latest version 1.9.0, you can easily add prefixes by customizing the Gadgets models properties, in SweetyVD.json file.
It is created at first run and can be modified with notepad or other.

To do this, just change the name value as you wish. Ex here with TextGadget. Default Name = "Text" changed here to "sText" or "TextBox",...
For each Gadget, you can also change the default width and height
and possibly the default properties by keeping the current tags (#Text:, #Mini:, #Maxi,...). Ex here with "#Text:My Default Text"
And for Constants use the suffix (x) to choose the one activated by default.
Enlighten me, I do not really understand your use for Postfixes, they are GadgetID!
Code:
    "Model"            : "TextGadget",
    "Name"             : "sText",
    "Caption"          : "#Text:My Default Text",
    "DftWidth"         : 100,
    "DftHeight"        : 20,
    "Constants"        : "Text_Center|Text_Right(x)|Text_Border",

#
Do you reproduce the same with the latest version 1.9.0 ?
With the concept on true gadgets, there are some lags displays indeed, some already solved with for example containers and frame gadget drawn now.
I also added (not yet on Github) the resize (=WM_PAINT) of all the gadgets after a moving or resize, on KeyUp Event.
It should be a little better


Last edited by ChrisR on Thu May 04, 2017 6:33 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Thu May 04, 2017 6:00 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Feb 01, 2012 3:30 pm
Posts: 761
Location: Nottinghamshire UK
Hi ChrisR That`s spooky Just this very minute I`m Implementing a ButtonGadget() for a pre/post fix design window after the #GridSpacing gadget lol. I`ll get the latest download and have a look. Hope your enjoying programming SweetyVD as much as I like using it!!! :)

Zebuddi. :)

_________________
malleo, caput, bang. Ego, comprehendunt in tempore


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Thu May 04, 2017 6:13 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Feb 01, 2012 3:30 pm
Posts: 761
Location: Nottinghamshire UK
Hi ChrisR We have a draw issue when after adding gadgets and the using the preview, no gadgets are displayed unless the mouse hovers over the gadget positions, which draws the gadgets but corrupts the gadgets also if you move the horizontal scroller the gadgets are redrawn correctly.

The Ipgadget() issue has been resolved :) Thanks.


In compiler option menu --> tab Constants --> Custom Constants: I have added "#BuildVersion" and set it to current version "1.0.9" and added the constant to the main windowTitle just so I know i`m running the current version. Not sure if you have seen this option. Something you might want to do. :)

Zebuddi. :)

_________________
malleo, caput, bang. Ego, comprehendunt in tempore


Last edited by Zebuddi123 on Thu May 04, 2017 6:36 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Thu May 04, 2017 6:32 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 122
Location: France
Thanks, I have seen also for the Preview/Designer switch, it's fixed now but not on github yet.
I keep taking pleasure to develop it but I miss a bit of time and more precisely several hours at a time to develop Some tricks


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Thu May 04, 2017 7:05 pm 
Offline
User
User

Joined: Sun Dec 28, 2014 1:12 pm
Posts: 13
ChrisR wrote:
Don't be sorry, it is good to fix bugs I did not see :wink:

Got it, in Line 1008 change
Code:
For J=1 To ArraySize(ModelGadget())
==>
Code:
For J=0 To ArraySize(ModelGadget())
I did not see it first because in my JSON file, OpenWindow (Type=0) was at the beginning => ModelGadget() array element 0 ...


In Line 1537 change too:
Code:
Case 1 To 31   ;Popup menu for creating gadgets
==>
Code:
Case 0 To ArraySize(ModelGadget())   ;Popup menu for creating gadgets

ChrisR, Thank you so much for your long-awaited program.


Top
 Profile  
Reply with quote  
 Post subject: Re: SweetyVD (Visual Designer)
PostPosted: Fri May 05, 2017 3:54 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jan 08, 2017 10:27 pm
Posts: 122
Location: France
I added the custom Constants #BuildVersion Zebuddi. Thanks
@tester, thanks however it is is not really required here, for the Popup menu
Given your Nickname, I will wait for test results from you in next releases. You are welcome :wink:
I finished some additions, I am updating now...


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 154 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 11  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye