PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Drag a form. Out of Pure curiosity  (Read 562 times)

Petrus Vorster

  • Senior Member
  • ***
  • Posts: 465
Drag a form. Out of Pure curiosity
« on: July 16, 2020, 11:43:32 AM »

This is for all the very smart people here.
To search Google for this is remarkably difficult.

This question goes back way to the day of VB Dos until now.
We all use Forms, Dialogues, objects etc.

But what happens in the background to make a form "MOVE"?
In VBdos you moved a frame and then it moved the form once you released the mouse.
If believe early in Windows that used to be the case.

But what happens in the backgound? Do they keep snapshots of the background, simply overpaint the old area, redraw the new one?
Or how do they create that functionality "Drag"?

We drag forms and things the entire day on Pc's, but i have actually never figured out what processes of drawing/redrawing etc takes place to give this illusion of something moving, and now its 100% real time.

In Windows 95 of you moved a form too much you could see hundreds of boxes being drawn and removed, but what they actually do to repain the background is quite interesting.

-Regards Peter
Logged

philbar

  • Little Newbie
  • *
  • Posts: 18
Re: Drag a form. Out of Pure curiosity
« Reply #1 on: July 16, 2020, 05:18:38 PM »

You asked for smart people, so I shouldn't answer, but what the heck?

The secret is that computers, in particular the graphics processors, really are that much faster than they were in the old days. The thing you're dragging is a bitmap in memory. Memories used to be too small to waste them with copies of complicated bitmaps, but that's not a problem now. So your mouse moves a pixel or two, the bitmap is painted in the new position, and then the little sliver of the background is painted in the space that was uncovered. And it all happens like watching a movie.

Come to think of it, watching movies is another thing that didn't work very well way back when.

Sometimes when I'm playing with a program that has lots of controls to move when you resize the window, I just annoy it by moving the corner handles in circles to see if all the widgets can keep up. Nowadays it's rare to find a window with such complicated controls that it can't do it.

Phil
Logged

Petrus Vorster

  • Senior Member
  • ***
  • Posts: 465
Re: Drag a form. Out of Pure curiosity
« Reply #2 on: July 16, 2020, 06:11:37 PM »

Thanks!

I was wondering how they heck they managed to copy and repaint everything the whole time.
Still would like to see the code that makes that happen.
Pretty cool how you just can't see it happen like the film slides, but the action is still there.

I always was that kid that would take apart all the toys to see how they work and then never got them back perfectly again.
And that why i don't dig too far in the deep end of the code, because i will mess it up!

-Peter
Logged

Bumblebee

  • Junior Member
  • **
  • Posts: 50
Re: Drag a form. Out of Pure curiosity
« Reply #3 on: July 18, 2020, 05:43:05 AM »

The numerous GDI APIs are cryptic, but they would begin to answer the question of the mechanics of how it's done.
USER is responsible for the drawing of windows and menus, etc.
https://en.wikipedia.org/wiki/Windows_USER
Logged

Petrus Vorster

  • Senior Member
  • ***
  • Posts: 465
Re: Drag a form. Out of Pure curiosity
« Reply #4 on: July 21, 2020, 01:06:19 PM »

Dear Heavens, my drives are like a PawnShop.
I actually found VBdos here somewhere.
Had to run it on DOSBOX, got a few minutes of "the good old days", then realised how bad those days were and just how little you could do.
6 forms in Dos and you ran out of memory.

There are actually tutorials on the WEB with VBdos.
I am quite certain that even the most backward place on the planet moved past that.

Was fun dragging that around, then delete the bunch and uninstall DOSBOX.
That was NOT the good old days.

It was fun looking into it though.


Logged

raymw

  • Senior Member
  • ***
  • Posts: 409
Re: Drag a form. Out of Pure curiosity
« Reply #5 on: July 22, 2020, 01:08:09 PM »

It was the good old days. At the time, it fulfilled expectations. Much more accurate than a slide rule and back of an envelope (provided you understood the limitations of fp numbers). Now, most of what I see is just packaging and hype. Things being done, just so you can, adding nothing of real value. Take this forum, for example. (The actual screen appearance) Look how the various title bars, or whatever they are called, are shaded. No real purpose for that but in some opinions it looks better than plain colours. But go to attach: That area looks medieval, and functions in the same way. Does it actually work any better for the user compared to what was around ten years ago, say? Who came up with the idea for a background image for the desktop? It just prevents clearly seeing the icons.

I came here, because i was looking for something as simple as visual basic for dos. Got to firefly, then this wfbe. That was after many years of frustration with visual studio, c#, and I'd put years of work into c#. You youngsters don't know how good you got it, in my younger days we had to file lumps of germanium to make our own transistors XD.
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9313
  • Windows 10
    • PlanetSquires Software
Re: Drag a form. Out of Pure curiosity
« Reply #6 on: July 22, 2020, 05:06:25 PM »

You youngsters don't know how good you got it, in my younger days we had to file lumps of germanium to make our own transistors XD.

LOL  :-)
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Petrus Vorster

  • Senior Member
  • ***
  • Posts: 465
Re: Drag a form. Out of Pure curiosity
« Reply #7 on: July 23, 2020, 12:55:11 PM »

Hahaha also true.

I actually met a guy in his 80's now that does freelance plumbing around here.
Turns out he used to be a Mainframe programmer.
They had to write the code to move the arm on the enormous big 10MB drives, count the sectors and spool the tapes.
They actually had to program the servo motors on those drives when to start and stop!!

YEs so i have found you a Germanium miner in the flesh!
I loved my Commodore 64, but i could only make Input, scroll text and impress my buddies with weird noises if i play the cassette in a tape deck!

How times change!
Logged

raymw

  • Senior Member
  • ***
  • Posts: 409
Re: Drag a form. Out of Pure curiosity
« Reply #8 on: July 23, 2020, 01:57:14 PM »

When commodore imported their 'business machines' into the UK, they had two models, 4k, and 8k memory. Both had the same boards, but for the UK they drilled holes where you install the extra sockets and chips for making the 4k into an 8. Apple learnt from them, I guess.
Logged