Archive for July, 2005

Windows 2003 and MySQL

A short post here. Had to install and run MySQL on Windows 2003. Didn’t work.
Just used the standard install for 4.0.25; it wouldn’t start, not from a service and not from winmysqladmin.exe. Everything seemed ok though, but nothing in the logs and the Windows event viewer kept saying it ‘couldn’t find the file’. Which was rubbish.
Tried 3.23.58 which didn’t work either. I just wanted MySQL to tell me what was wrong, but it said nothing, it just died.

Finally I got it to work using mysqld -T ; I don’t know what that is, but it works. Nice experience with Windows again 🙂 Thank god for apt-get install mysql-server!

Dragging and dropping controls in RealBasic

Someone recently asked me to figure out how to make an application to drag & drop controls on a canvas in RealBasic (RealBasic 2005 to be exact). I thought that about a billion people would have done this by now and would have put their stuff on the web. This turned out not to be true.

The way to do it is actually trivial in any event-driven language, but in RealBasic it seems even easier 🙂

I will show the dragging and dropping of a pushbutton; you can figure out the rest for yourself. Do not pay attention to the quality of the code; I was only supposed to figure out how to do it, not win any prices!

Make a Window and put a PushButton on it. Now add some properties:

  • obj as Object
  • x as Integer
  • y as Integer
  • move as Boolean

Put in the MouseDown of the PushButton:

obj = me
return true

and in the MouseUp of the PushButton:

obj = nil
return true

Now put in the MouseMove of the Window:

dim ctl as RectControl

if obj<>nil then
ctl = RectControl(obj)
end if

if (not move and obj <> nil) then
dx = x – ctl.Left
dy = y – ctl.Top
move = true
MouseCursor = System.Cursors.ArrowAllDirections
end if

if (move and obj = nil) then
move = false
MouseCursor = System.Cursors.StandardPointer
end if

if (move and x >0 and y>0 and x < me.width and y < me.Height) then
ctl.Left = x – dx
ctl.Top = y-dy
end if

And that’s it 🙂