This perhaps had been brought up many times before, however I had not found an answer on the Internet.
I had been trying to set the edge level to 0, and I had googled it, and the first answer I got was of course for the wrong question, but it looked like it was right. And it said to click Shift + S, which of course was the thing that messed around with the Transform Widget and stuff, however I had not know it at the time. After playing around with it, the widget had been completely detached from the mesh, and would not stay on when I set it back to it. How do I make it stay on the mesh?
There’s wrong terminology problem in your question so I’d advise include screenshots into the question to point out what exactly do you mean. From further comments looks like your question is about pivot point.
Transformation in Blender can be done using shortcuts on keyboard like G to grab R to rotate S to scale or clicking with mouse on transform gizmos. Transformation will happen around pivot point. Depending on the mode chosen results will differ.
Gizmos will appear according to the currently active pivot point; they will be shown in the same point around which shortcuts for transformation work.
If Pivot point is set to 3D cursor then gizmos will appear where 3D cursor is placed.
If pivot is set to Active Element - then to the object selected last.
If to Median Point or Bounding box - then roughly in the center of selection (depending on the case). Transformation will happen around that point. One should also keep in mind that origin point of an object in Object mode is the point which will be used as pivot point for transform if pivot is set to anything other than 3D cursor.
Now if gizmo appears somewhere outside of selection first look which pivot point mode is used. If it’s set to anything other than 3D cursor then look up how many selections you have and where are object origins placed (if in Object mode).
What Zak said, also, if your mesh is an unusal shape, it won’t neccesarily be placed where you expect. The origin of the mesh can be anywhere depending on what was done during editing and assinging the 3d cursor location and pivot point. Whenever you are not sure, you can select the object, go to object->Transform->Origin to geometry.