In my script, one option is to edit a file before processing it in another option, the trouble is , it will only work if I include the "ShowVar" statement for the variable ..
the code in my script:
If the showvar statement is excluded the script shows a blank variable, but when it is included the variable shows correctly. I've been stuck on this for weeks now and it is driving me nuts!
when I created a test version with just this element, it works with or without the showvar statement. "Input Logging" option, just loads the file and does error checking.
Any suggestions welcomed.
the code in my script:
Code:
if left(a_dlg_button,18) = "vLogFileNameEvent_" then showFilename = .f. if a_dlg_button = "vLogFileNameEvent_popupdone" then vLogFileText = get_from_file(vLogFileName) [COLOR=#ff0000] showvar(vLogFileText)[/COLOR] select case Len(rtrim(vLogFileText)) = 0 ui_msg_box("Error:","File "+file.filename_parse(vLogFileName,"n")+" is Empty",UI_ATTENTION_SYMBOL) ShowEdit = .f. a_dlg_button = "" case left(vLogFiletext,1) <> "#" ui_msg_box("Error: ","File "+file.filename_parse(vLogFileName,"n")+" has no Header",UI_ATTENTION_SYMBOL) ShowEdit = .f. a_dlg_button = "" case else ShowEdit = if(vOpt="Edit Logging",.t.,.f.) a_dlg_button = "" end select a_dlg_button = "" end if a_dlg_button = "" end if
when I created a test version with just this element, it works with or without the showvar statement. "Input Logging" option, just loads the file and does error checking.
Code:
dlg_title = "testing" showedit = .f. showfilename = .f. dim vLogFileText as c ui_dlg_box(dlg_title,<<%dlg% {region} (vOpt:Input Logging)(vOpt:Edit Logging) {watch=vOpt!vOptEvent} {endregion}; {region22} {condition=(ShowFileName=.t.)} {text=16vOpt}: [%p=ui_get_file("Input Log Filename","Log(*.Log)|Text (*.txt)",Filename_Decode("[Logpath]")+"*.log","X");I=$a5_smart_file%.81vLogFilename!vLogFileNameEvent_*] {endregion22}; {region23} {condition=ShowEdit=.t.} Log: [%mw%.40,18vLogFileText]{sp=2} {endregion23} %dlg%,<<%code% if a_dlg_button = "vOptEvent" then showfilename = .t. a_dlg_button = "" end if if left(a_dlg_button,18) = "vLogFileNameEvent_" then showFilename = .f. if a_dlg_button = "vLogFileNameEvent_popupdone" then vLogFileText = get_from_file(vLogFileName) [COLOR=#ff0000]' showvar(vLogFileText)[/COLOR] select case Len(rtrim(vLogFileText)) = 0 ui_msg_box("Error:","File "+file.filename_parse(vLogFileName,"n")+" is Empty",UI_ATTENTION_SYMBOL) ShowEdit = .f. a_dlg_button = "" case left(vLogFiletext,1) <> "#" ui_msg_box("Error: ","File "+file.filename_parse(vLogFileName,"n")+" has no Header",UI_ATTENTION_SYMBOL) ShowEdit = .f. case else ShowEdit = if(vOpt="Edit Logging",.t.,.f.) end select end if a_dlg_button = "" end if %code%)
Comment