Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get variable in dialog
#1
i have a contextmenu entry called XML Lister,
its for generating a xml list for a flash slideshow.

when a jpeg has not iptc caption a dialog will ask for a name.
for usability i want to show the picture but i don't know
how to get sb4 string in my xmllister dialog, so that i can scale the picture.

Code:
Copy      Help
typelib GflAx {059321F1-207A-47A7-93A1-29CDF876FDD3} 1.0 1
GflAx.GflAx g._create
str f _caption xmlbody xmltmp; Dir d
str xml=
;<?xml version="1.0"?>
;<mySlideShow>
;CONTENT
;</mySlideShow>

str pic=
;<picture>
;<description>CAPTION</description>
;<source>FILE</source>
;</picture>

foreach f files
,f.format("%s\*" f)
,foreach(d f FE_Dir)
,,g.LoadBitmap(d.FileName(1))
,,if len(g.IPTCCaption)<1
,,,str controls = "3 4"
,,,str e3 sb4
,,,sb4=d.FileName(1)
,,,if(!ShowDialog("xmllister" &xmllister &controls)) ret
,,,xmltmp=pic
,,,xmltmp.findreplace("CAPTION" e3)
,,,xmltmp.findreplace("FILE" d.FileName)
,,,xmlbody.formata("%s[]" xmltmp)
,,else
,,,_s=g.IPTCCaption
,,,xmltmp=pic
,,,xmltmp.findreplace("CAPTION" _s)
,,,xmltmp.findreplace("FILE" d.FileName)
,,,xmlbody.formata("%s[]" xmltmp)
xmlbody.trim
xml.findreplace("CONTENT" xmlbody)        
out xml


xmllister dialog:
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 241 135 "XML Lister"
;3 Edit 0x54030080 0x200 2 2 128 12 ""
;1 Button 0x54030001 0x4 4 74 48 14 "OK"
;2 Button 0x54030000 0x4 56 74 48 14 "Cancel"
;4 Static 0x5400100E 0x20000 136 2 98 66 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010805 "" ""


ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)

sel message
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1

ps. feel free to teach me where my code is too long.
thanks.
pi
#2
You can access original dialog variables using function DT_GetVariables or DT_GetControls. Better would be to use user-defined type for dialog variables. If using str variables, the code would be

str* dv=DT_GetVariables(hDlg)
out dv[2]

This function does not populate variables with current values. Function DT_GetControls does.

str* dv=DT_GetControls(hDlg)
out dv[2]
#3
thanks.

dv==DialogVariable Array ?
pi
#4
it is address of controls variable. That is, third argument of ShowDialog. Adjacently declared local variables of same type are like array. When you know address of first variable, you can access all variables using [].
#5
cool, this is something i understand 8)
pi


Forum Jump:


Users browsing this thread: 1 Guest(s)