Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: drag'n'drop question plus properties

  1. #1
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    48
    Posts
    919
    Rep Power
    105

    drag'n'drop question plus properties

    hello. I've a general question about "drag'n'drop" function for folders or files into tbgl window (or similiar to ui canvas modus): it's possible to drag properties of an primitive (sphere, cube etc.) as colour, material, texture, scaling factor or something else via drag'n'drop? does anybody has experience with this one? thanks in advance, frank
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  2. #2
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    51
    Posts
    1,436
    Blog Entries
    2
    Rep Power
    158
    Currently I think only drag-in of files from explorer or desktop is possible when you use just the TBGL-window. So I fear there's no way to drag stuff out of TBGL-window nor to recognize a drag-out - except you have your own GUI within TBGL which would be some internal drag'n drop - or you use UI-canvas and callbacks which both doesn't have much to do with TBGL_BindWindowEvent/TBGL_OnDropFiles then.

    A weird idea to get around this: save a small file onto the desktop/ into some special folder if the user clicks onto something. When the file gets dragged in you can use the data - either delete it then or leave it re-useable

    Find an example here
    (scroll all the way down there)
    Last edited by ReneMiner; 08-08-2013 at 20:04.
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    OS: Windows 11 Enterprise x64 Build 22065 (21H2 pre-release)
    (says the systeminfo. anything else says it were Windows 10 - more or less insider - a lot of the system settings do not function - i could imagine it will not send feedback to microsoft since it always says i need a new app to open that feedback-hub-link. But hey: thinbasic runs well )

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,089
    Blog Entries
    5
    Rep Power
    726
    Hi Frank,

    I haven't seen you for a while here, welcome back

    If I understand you correctly - you are not talking about dragging something into TBGL window, but dragging it out of it?
    For example dragging from orange sphere in TBGL world out of the window to notepad for example, where 255,128,64 would magically appear?

    I think functionality like this could be done right now this way:
    • you detect mouse down on some object in 3D world
    • you use TBGL_GetPixelInfo to retrieve coordinate/color where you clicked
    • you lookup your internal database to guess which object that fragment belongs to
    • you store the information you need to clipboard (via Clipboard_SetText)
    • once you detect mouse up outside of window (that is, TBGL_MouseGetPosX returns -1, but you can still catch the mouse up via GetAsyncKeyState, which works on global level)
    • you set focus to the window you hover over
    • you use SendKeys to artifically launch Ctrl-V sequence there


    For the other way the approach Rene talks about is perfectly valid and it is only up to you how do you handle dragged file. If it is BMP or TGA, you could load it as texture, and via technique similar to the one above detect and update the object.
    If you have material defined in your own fileformat somewhere, you could do it again - just check the extension and based on it decide the action.


    Petr
    Last edited by Petr Schreiber; 08-08-2013 at 20:35.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #4
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    48
    Posts
    919
    Rep Power
    105
    thanks rene and petr for feedback and the link. yes, I've didn't work a long time with thinbasic and much more with oxygen (great programming software and it's getting better and better as you perhaps know) last weeks and month if there's enough time beside family, job and daughter..

    If I understand you correctly - you are not talking about dragging something into TBGL window, but dragging it out of it?
    no, I am talking about dragging something from a sdk win api "dialog" with material content or properties or components into TBGL window

    I am working with an 3d graphic software and there's a lot of embedded winapi's (sdk modus) with tab's so far as I know and in centre the main openGL window with grid plane and x,y,z axis for 3d coordination. left side theres a "material" tab (own sdk window) inside something like a "list" for material if you cklick it theres a new "dialog" with all properties you can imagine like colour, size, scaling, translate (position) and much more for primitives.

    after creation of a simple sphere, activate it (!) in the list view and if you're clicking a material from the "list" (I suppose it's a list) you can "drag'n'drop" the material in directly way onto the open GL window on the primitive you like. now the sphere have detached with (for example) "copper" colour and you have access to all properties of this new colored sphere. so after knowing much more of drag'n'drop behaviour of folder it may possible for script's and files with "tbgl or openGL" content too to go same way as the 3d graphic software. My interest was only how they made it and what's trick behind this drag'n'drop feature for "components" as charles titled it yesterday with a good name.

    I will create a demo for my idea.

    if you like you can have a look at this oxygen page :-)
    http://www.oxygenbasic.org/forum/ind...icseen#msg6754


    thanks, frank
    Last edited by Lionheart008; 09-08-2013 at 10:43.
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  5. #5
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    51
    Posts
    1,436
    Blog Entries
    2
    Rep Power
    158
    can't you change the behaviour of that dialog/listview-wherever you drag that data from - maybe set it to clipboard on right-click or some shift-click... - and also detect right-click/shift-click in TBGL-window to insert it here?
    -even more than one usage possible then - without need to move the mouse back to the other window - just like dipping a brush into the color and paint...
    Last edited by ReneMiner; 09-08-2013 at 13:50.
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    OS: Windows 11 Enterprise x64 Build 22065 (21H2 pre-release)
    (says the systeminfo. anything else says it were Windows 10 - more or less insider - a lot of the system settings do not function - i could imagine it will not send feedback to microsoft since it always says i need a new app to open that feedback-hub-link. But hey: thinbasic runs well )

  6. #6
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    51
    Posts
    1,436
    Blog Entries
    2
    Rep Power
    158
    Just some common - not TBGL-specific question, but fits this topic and I'm too lazy to open extra thread since forum search for Drag & Drop brought me here ...

    How can I do similar function (drag in of filenames) using standard windows (or controls), so to say when
    Uses "UI"
    
    because have some canvas-bound TBGL-display?

    Petr, could you make some *.tBasicU or *.inc-file from Drag-In-Function please? I'm going nuts when I have to find out from MS-sites before I've found out...
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    OS: Windows 11 Enterprise x64 Build 22065 (21H2 pre-release)
    (says the systeminfo. anything else says it were Windows 10 - more or less insider - a lot of the system settings do not function - i could imagine it will not send feedback to microsoft since it always says i need a new app to open that feedback-hub-link. But hey: thinbasic runs well )

  7. #7
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,089
    Blog Entries
    5
    Rep Power
    726
    Hi Rene,

    I will port the code from TBGL to ThinBASIC unit, stay tuned!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,089
    Blog Entries
    5
    Rep Power
    726
    Experimental ThinBASIC DragNDrop module at your disposal...

    I attach the module, it's source code and testing example to give you idea on how to use.
    Module contains the following functions:
    • DND_Activate - activates given window for user events
    • DND_Deactivate - deactivates given window for user events
    • DND_BindWindowEvent - binds specific event, in this case %DND_OnDropFiles
    • DND_UnBindWindowEvent - unbinds specific event, in this case %DND_OnDropFiles
    • DND_GetCallingWindow - returns calling window in the handler procedure
    • DND_OnDropFiles_GetFileCount - returns file count in the handler procedure
    • DND_OnDropFiles_GetFileName - returns file name #n in the handler procedure


    Limitation: I just spent 1,5 hour debugging and then I realised, that if you launch script with Admin privileges, or if you launch script from thinAir with Admin privileges, it won't work. It is a feature of operating system, dragging files does not work for me in Sony Vegas too, when launched with Admin privileges.

    I hope you will find it useful, source code is in PB/Win 10, but there is the DLL file directly too, for those who don't feel like modding it


    Petr
    Attached Files Attached Files
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  9. #9
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    51
    Posts
    1,436
    Blog Entries
    2
    Rep Power
    158
    Great stuff, thanx a lot. Will it become a module because already uses "USES" and also fits naming conventions?

    Will there be no admin-issue if I put the dll into thinBasic\lib-folder?
    Last edited by ReneMiner; 01-11-2013 at 15:00.
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    OS: Windows 11 Enterprise x64 Build 22065 (21H2 pre-release)
    (says the systeminfo. anything else says it were Windows 10 - more or less insider - a lot of the system settings do not function - i could imagine it will not send feedback to microsoft since it always says i need a new app to open that feedback-hub-link. But hey: thinbasic runs well )

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,089
    Blog Entries
    5
    Rep Power
    726
    Hi Rene,

    I already made it module, I don't think it is worth adding to official distribution yet, but feel free to add it to your Lib directory.
    Regarding Admin issue - I am googling for workaround, but I don't give it much chance.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Page 1 of 2 12 LastLast

Similar Threads

  1. One drop per 9 years
    By zak in forum Science
    Replies: 4
    Last Post: 29-02-2012, 08:14
  2. Properties
    By efgee in forum O2h Compiler
    Replies: 7
    Last Post: 03-09-2010, 23:09
  3. drag drop question
    By TomLebowski in forum File
    Replies: 6
    Last Post: 29-01-2010, 16:10
  4. How to Drop a file onto an Input box?
    By dan_moran in forum UI (User Interface)
    Replies: 8
    Last Post: 13-11-2008, 00:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •