GOOSE

Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору sertash Это засовываешь в Глобальные функции: Код: function AddToolTip(sObject, sTip) if not tblToolTips then --create the table if it doesn't exist tblToolTips={} end --add the object and tip to the table tblToolTips[Table.Count(tblToolTips)+1]={Object=sObject, Tip=sTip} end function ShowTips() local mi = nil local mObject = nil local mtblObj = nil local mtblPos = nil local mtblDimension = nil local mType --get the page objects mtblObj = Page.EnumerateObjects() --loop through the objects for mi, mObject in mtblObj do --get the object type mObjType = Page.GetObjectType(mObject) --series of If/Then/Else to get the position --and dimension of the object if mObjType == OBJECT_BUTTON then mType = "Button" mtblPos = Button.GetPos(mObject) mtblDimension = Button.GetSize(mObject) elseif mObjType == OBJECT_FLASH then mType = "Flash" mtblPos = Flash.GetPos(mObject) mtblDimension = Flash.GetSize(mObject) elseif mObjType == OBJECT_HOTSPOT then mType = "HotSpot" mtblPos = Hotspot.GetPos(mObject) mtblDimension = Hotspot.GetSize(mObject) elseif mObjType == OBJECT_IMAGE then mType = "Image" mtblPos = Image.GetPos(mObject) mtblDimension = Image.GetSize(mObject) elseif mObjType == OBJECT_INPUT then mType = "Input" mtblPos = Input.GetPos(mObject) mtblDimension = Input.GetSize(mObject) elseif mObjType == OBJECT_LABEL then mType = "Label" mtblPos = Label.GetPos(mObject) mtblDimension = Label.GetSize(mObject) elseif mObjType == OBJECT_LISTBOX then mType = "ListBox" mtblPos = ListBox.GetPos(mObject) mtblDimension = ListBox.GetSize(mObject) elseif mObjType == OBJECT_PARAGRAPH then mType = "Paragraph" mtblPos = Paragraph.GetPos(mObject) mtblDimension = Paragraph.GetSize(mObject) elseif mObjType == OBJECT_PLUGIN then mType = "Plugin" mtblPos = Plugin.GetPos(mObject) mtblDimension = Plugin.GetSize(mObject) elseif mObjType == OBJECT_VIDEO then mType = "Video" mtblPos = Video.GetPos(mObject) mtblDimension = Video.GetSize(mObject) elseif mObjType == OBJECT_WEB then mType = "Web" mtblPos = Web.GetPos(mObject) mtblDimension = Web.GetSize(mObject) end --if our last object isn't set, set it to "" if sLastObject == nil then sLastObject = "" end --if the handle to the tooltip window is nil, set it to -1 if hwndTooltip == nil then hwndTooltip = -1 end if mtblPos then --get the mouse pointers X and Y position mX=String.ToNumber(DLL.CallFunction("AutoPlay\\Docs\\mouse.dll", "GetMouseX", Application.GetWndHandle(), DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)) mY=String.ToNumber(DLL.CallFunction("AutoPlay\\Docs\\mouse.dll", "GetMouseY", Application.GetWndHandle(), DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)) if (mtblPos.X <= mX) and (mX <= (mtblPos.X + mtblDimension.Width)) and (mY >= mtblPos.Y) and (mY <= (mtblPos.Y + mtblDimension.Height)) then if mObject ~= sLastObject then --if we have moused over a new object sLastObject = mObject for n=1, Table.Count(tblToolTips) do if (mObject == tblToolTips[n].Object) then --if were over the object, show the tooltip hwndTooltip = DLL.CallFunction("AutoPlay\\Docs\\SetTip.DLL", "SetTip", Application.GetWndHandle()..","..mtblPos.X..","..mtblPos.Y..",\""..tblToolTips[n].Tip.."\","..hwndTooltip, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL) end end end end end end end | Это - в On Show Код: --[[ AddToolTip( Имя объекта, на котором нужно показать АЛЬТ, Текст АЛЬТа ) --учти, перевод строки в проге: \r\n Ниже в примере поймешь... ]]-- --add Button1 and it's tooltip AddToolTip("Button1", "Black Button\r\nWhite Letters\r\nClick it, and nothing happens") --add Button1 and it's tooltip AddToolTip("Button2", "Blue Button\r\nWhite Letters\r\nClick it, and it does nothing.") --add Image1 and it's tooltip AddToolTip("Image1", "This is a Brown Panel that I grabbed from the gallery.") --add Label1 and it's tooltip AddToolTip("Label1", "This is a Label with a really long\r\ntooltip that I created so I\r\ncould see how well it handled them.") Page.StartTimer(50) --ставишь, сколько нужно | А это в On Timer Код: ShowTips() err = Application.GetLastError() if err ~=0 then Page.StopTimer() Dialog.Message("", _tblErrorMessages[err]) end |
|