PDA

View Full Version : Font Dialog Problem


dorkauf89
01-26-2008, 08:40 AM
Hello, I have a problem!
I got this script and dll from a project I found on a forum:
http://www.indigorose.com/forums/showpost.php?p=86687&postcount=2
and I played with the script so it would make my input's properties what the user picks in the dialog cause in the example project it only writes what they picked in a paragraph object... This is what I got after a while:
function GetFont()
sFontInfo = DLL.CallFunction("AutoPlay\\Docs\\ChoosFont.dll", "FontDialog", Application.GetWndHandle(), DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
FontName=DLL.CallFunction("AutoPlay\\Docs\\ChoosFont.dll", "GetField","\""..sFontInfo.."\",\";\","..1, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
FontSize=String.ToNumber(DLL.CallFunction("AutoPlay\\Docs\\ChoosFont.dll", "GetField","\""..sFontInfo.."\",\";\","..2, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL))
InputStyle=DLL.CallFunction("AutoPlay\\Docs\\ChoosFont.dll", "GetField","\""..sFontInfo.."\",\";\","..3, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
FontColor=String.ToNumber(DLL.CallFunction("AutoPlay\\Docs\\ChoosFont.dll", "GetField","\""..sFontInfo.."\",\";\","..4, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL))
FontWeight = FW_NORMAL
FontItalic = false
FontUnderline = false
FontStrikeout = false

if String.Length(InputStyle) > 0 then
if String.Find(InputStyle,"B",1) > -1 then
FontWeight = FW_BOLD
end
if String.Find(InputStyle,"I",1) > -1 then
FontItalic = true
end
if String.Find(InputStyle,"U",1) > -1 then
FontUnderline = true
end
if String.Find(InputStyle,"S",1) > -1 then
FontStrikeout = true
end
end

return {FontName,FontSize,FontWeight,FontItalic,FontUnder line,FontStrikeout,FontColor}
end
tblFontInfo = GetFont();
Input.SetProperties("Input1", tblFontInfo);
And it doesn't work... Help... I want to use the dll in that forum to let the user pick the font properties and then apply the properties to a input object... Something like the one in the following forum:
http://www.indigorose.com/forums/showthread.php?t=18895&highlight=ColorDialog+plug-in
but i'm not using that because it does some problems in vista... When I close the window it says program stopped responding and stuff... THANKS

dorkauf89
01-27-2008, 06:18 AM
can anyone please help me???

RizlaUK
01-27-2008, 08:08 AM
Here, try it like this

function GetFont()
tblRetFontInfo={}
sFontInfo = DLL.CallFunction("AutoPlay\\Docs\\ChoosFont.dll", "FontDialog", Application.GetWndHandle(), DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
tblRetFontInfo.FontName=DLL.CallFunction("AutoPlay\\Docs\\ChoosFont.dll", "GetField","\""..sFontInfo.."\",\";\","..1, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
tblRetFontInfo.FontSize=String.ToNumber(DLL.CallFu nction("AutoPlay\\Docs\\ChoosFont.dll", "GetField","\""..sFontInfo.."\",\";\","..2, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL))
InputStyle=DLL.CallFunction("AutoPlay\\Docs\\ChoosFont.dll", "GetField","\""..sFontInfo.."\",\";\","..3, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
tblRetFontInfo.FontColor=String.ToNumber(DLL.CallF unction("AutoPlay\\Docs\\ChoosFont.dll", "GetField","\""..sFontInfo.."\",\";\","..4, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL))
tblRetFontInfo.FontWeight = FW_NORMAL
tblRetFontInfo.FontItalic = false
tblRetFontInfo.FontUnderline = false
tblRetFontInfo.FontStrikeout = false

if String.Length(InputStyle) > 0 then
if String.Find(InputStyle,"B",1) > -1 then
tblRetFontInfo.FontWeight = FW_BOLD
end
if String.Find(InputStyle,"I",1) > -1 then
tblRetFontInfo.FontItalic = true
end
if String.Find(InputStyle,"U",1) > -1 then
tblRetFontInfo.FontUnderline = true
end
if String.Find(InputStyle,"S",1) > -1 then
tblRetFontInfo.FontStrikeout = true
end
end
return tblRetFontInfo
end

tblFontInfo = GetFont();
Input.SetProperties("Input1", tblFontInfo);

instead of returning the elements, build a table and return that

dorkauf89
01-27-2008, 03:00 PM
Thank you so much! I hardly understood what I was doing.. I was playing with it until I got something that looked like it should work... lol

RizlaUK
01-27-2008, 03:11 PM
well i think thats how most of us learned, this forum is a wealth of information