I have an xdialog with an {Imageviewer} control. Once the xdialog is open, clicking on a file name in the image list shows the image. I've tried various ways to get the first file in the list to show on startup, but without success. The first file in the text file list opens just fine on startup.
Here's the code
XDforAlphaBoard.png
Any suggestions?
Here's the code
Code:
dim lv as p = local_variables() dim imgpath as c = A5.Get_Exe_Path() + chr(92) dim computer_name as c = api_getmachinename() Dim format as p Format.tab_stops="" Format.odd_row_color="White" Format.even_row_color="White" Format.odd_selected_color="Dark Blue" Format.even_selected_color="Dark Blue" Format.font="tahoma,10" Format.font_color_unselected="Black" Format.font_color_selected="White" Format.lastbutton="OK" Format.group_size=1 Format.number_rows=.f. Format.alternating_bands=.f. ' dim imgs as C dim txtfiles as C dim varC_result as C dim dlg_title as c = "MANUAL DL INFORMATION ACQUISITION" dim iv as p iv.width = 0 iv.height = 0 iv.loadEvent = "Load" dim mode as c ImgList = filefind.get(imgpath + "*.jpg",file_find_normal+file_find_not_directory,"N") auto_list_imgs = ImgList 'Apply 'owner draw' formatting information to the list auto_list_imgs = a5_owner_draw_list_fmt(auto_list_imgs,Format) temp_count = w_count(auto_list_imgs,crlf()) DELETE a_imgs DIM a_imgs[temp_count] as c a_imgs.initialize(auto_list_imgs) dim image_name as c = "" 'if imglist <> "" then ' image_name = imgpath + word(imglist,1,crlf()) 'end if TxtList = filefind.get(imgpath + "*.txt",file_find_normal+file_find_not_directory,"N") auto_list_txtfiles = txtlist auto_list_txtfiles = a5_owner_draw_list_fmt(auto_list_txtfiles,Format) temp_count = w_count(auto_list_txtfiles,crlf()) DELETE a_txtfiles DIM a_txtfiles[temp_count] as c a_txtfiles.initialize(auto_list_txtfiles) if alltrim(txtlist) <> "" then dim file_name as c = word(txtlist,1,crlf()) file_name = imgpath + file_name dim fileinfo as c = file.to_string(file_name) end if dim explaintext as c = GetExplainText() heading_string = "The image file name prefix (under \"Available Images\") must match the driver's license number EXACTLY for the \"Auto Acquire\" to work properly. The text file prefix (see below) must also match exactly.\ Use this form when the scanner fails to read either (or both) image or text file names and contents accurately." footer_string = "" ok_button_label = "&OK" cancel_button_label = "&Cancel" dim dlg_code as c = <<%dlg% {can_exit=NoExit} {background=Pale Yellow} {region}{font=tahoma,10,b} {text=150,4:heading_string}; {endregion}; {region}{font=tahoma,10} | Available Image Files:{sp=19}DL Image:; | [%d;O={@@}%.40,10imgs^#a_imgs!imgs_*]{sp=4}{imageViewer=110,25iv};; {lf}; | Available Text Files:{sp=22}DL Text:; | [%d;O={@@}%.40,10txtfiles^#a_txtfiles!txtfiles_*]{sp=4}[%mw%.110,10fileinfo];; | [%Rmw%.155,3ExplainText]; {endregion}; {region} {text=55,1:footer_string}; {endregion}; {line=1,0}; {region}{justify=center} <15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg% dim event_code as c = <<%code% if a_dlg_button = "CANCEL" then ui_modeless_dlg_close(dlg_title) end if if a_dlg_button = "NoExit" then a_dlg_button = "" end if if a_dlg_button = "init" then 'image_name = imgpath + word(imgs,1,crlf()) 'ShowImage(lv) end if if a_dlg_button = "load" then 'ui_msg_box("","loaded") end if if left(a_dlg_button,5) = "imgs_" then if a_dlg_button = "imgs_change" then a_dlg_button = "" image_name = imgpath + alltrim(imgs) ShowImage(lv) ui_yield() xbasic_wait_for_idle() ui_dlg_refresh(dlg_title) else a_dlg_button = "" end if elseif left(a_dlg_button,9) = "txtfiles_" then if a_dlg_button = "txtfiles_change" then a_dlg_button = "" file_name = imgpath + alltrim(txtfiles) fileinfo = file.to_string(file_name) else a_dlg_button = "" end if else a_dlg_button = "" end if %code% varC_result = ui_dlg_box(dlg_title,dlg_code,event_code) 'ui_modeless_dlg_box(dlg_title,dlg_code,event_code) '-------------------------------------------- Function ShowImage as L (lv as p) with lv mode = "Best Fit" iv.object.setMode(mode) if file.exists(image_name) then iv.object.loadImage(image_name) end if ui_dlg_refresh(dlg_title) end with End function '-------------------------------------------- Function GetExplainText as c () GetExplainText = "This is where the instructions will go." End Function '--------------------------------------------
Any suggestions?
Comment