fbpx
Welcome, Guest
Username: Password: Remember me
This forum is the place to discuss issues related to ReportPro, Xs2Ado, Vo2Ado, bBrowser and other 3rd party products
  • Page:
  • 1

TOPIC:

ReportPro3 anoying bug with pictures fixed 04 May 2021 16:15 #18306

  • HeikoP's Avatar

  • HeikoP

  • Topic Author


  • Posts: 35
  • Hello world,

    i just fixed an really annoying bug in ReportPro 3 with pictures. If you add a picture and say it´s filename is returned by an expression and edit this again and say ok again without changing anything, it will change the picture to "from file". YOu can see this if you edit this again. The reasion is, that an the event OnControlClick is fired, when the obict is edited, but only if the picture-status is different from "from file". I think this is really bad code and i fixed it by making it worse ;-)

    There are two exported usuals called self:expression and self:ExpIsFile, which are nil when the objects is initialized. I try to initialize the value in the OnControlClick method and if "from file" is selected in the initParam Method. See the code below. I still haven´t found out why this event is fired during intitialisation of this object only in certain cases, but however: It work for me.

    Maybe someone is interested in this.

    Heiko



    method OnControlClick(oEvent as cControlClickEvent) as longint pascal class rpDOPictureStyleDlg

    #ifdef DESIGNENV

    local oControl as cControl
    * local uRetval as usual



    ~"ONLYEARLY+"
    * uRetval:=super:OnControlClick(oEvent)


    if self:lActive
    oControl:=oEvent:Control

    if oControl==self:oCCFileBtn
    * HJP 20210504 Change because somehow this Method is called while the Dialog is initialized, if this code is not there then it chages automatically to Bitmap from file.
    * The user does not expect this.

    if self:Expression==nil
    self:Expression :=self:oObject:lExpression
    self:ExpIsFile :=self:oObject:lExpIsFile
    else
    self:Expression :=false
    self:ExpIsFile :=false
    endif
    * self:Expression :=false
    * self:ExpIsFile :=false

    elseif oControl==self:oCCExpFileBtn
    if self:Expression==nil
    self:Expression :=self:oObject:lExpression
    self:ExpIsFile :=self:oObject:lExpIsFile
    else
    self:Expression :=true
    self:ExpIsFile :=true
    endif
    * self:Expression :=true
    * self:ExpIsFile :=true

    elseif oControl==self:oCCExpBMPBtn
    if self:Expression=nil
    self:Expression :=self:oObject:lExpression
    self:ExpIsFile :=self:oObject:lExpIsFile
    else
    self:Expression :=true
    self:ExpIsFile :=false
    endif
    * self:Expression :=true
    * self:ExpIsFile :=false

    elseif oControl==self:oDCRetainAspectBtn
    self:RetainAspectRatio :=self:oDCRetainAspectBtn:Checked

    elseif oControl==self:oDCEmbedPictureBtn
    self:EmbedPicture :=self:oDCEmbedPictureBtn:Checked
    endif

    self:EnableControls()
    self:SetPictureStyle()

    endif
    return super:OnControlClick(oEvent)

    #endif

    ~"ONLYEARLY-"

    method InitParams(oPicture as rpPicture,oSection as rpBaseSection,lPoly as logic) as logic pascal class rpDOPictureStyleDlg

    #ifdef DESIGNENV

    ~"ONLYEARLY+"

    self:cHelpTopic :="Picture Style"

    self:Caption :=rpLangString(IDS_DO_PICTURE_STYLE)
    self:oDCSourceGroup:Caption :=rpLangString(IDS_PICTTYPE_SELTEXT)
    self:oCCFileBtn:Caption :=rpLangString(IDS_PICTTYPE_FILE)
    self:oCCExpFileBtn:Caption :=rpLangString(IDS_PICTTYPE_EXPFILE)
    self:oCCExpBMPBtn:Caption :=rpLangString(IDS_PICTTYPE_EXPBMP)

    self:oDCRetainAspectBtn:Caption :=rpLangString(IDS_RETAIN_ASPECT)
    self:oDCEmbedPictureBtn:Caption :=rpLangString(IDS_DO_EMBED_PICTURE)

    self:oCCOkBtn:Caption :=rpLangString(IDL_BTN_OK)
    self:oCCCancelBtn:Caption :=rpLangString(IDL_BTN_CANCEL)
    self:oCCApplyAllBtn:Caption :=rpLangString(IDS_BTN_APPLYALL)

    self:oObject :=oPicture:Clone()
    self:oSection :=oSection
    self:oDCDOExample:DrawObject :=self:oObject

    self:oCCFileBtn:Pressed :=!self:oObject:lExpression

    * HJP 20210504 Change because somehow the OnControlClick Method is called while the Dialog is initialized but only then, when lExpression is true,
    * if this code is not there then it chages automatically to Bitmap from file.
    * The user does not expect this. Let´s make bad code worse :-(

    if self:oCCFileBtn:Pressed
    self:Expression :=false
    self:ExpIsFile :=false
    endif


    self:oCCExpFileBtn:Pressed :=self:oObject:lExpression .and. self:oObject:lExpIsFile
    self:oCCExpBMPBtn:Pressed :=self:oObject:lExpression .and. !self:oObject:lExpIsFile

    self:oDCSourceEdit:TextValue :=self:oObject:cSource

    self:oDCRetainAspectBtn:Checked :=self:oObject:lRetainAspectRatio
    self:oDCEmbedPictureBtn:Checked :=self:oObject:lEmbedPicture

    if !lPoly
    self:oCCApplyAllBtn:Hide()
    endif

    self:EnableControls()


    self:lActive :=true

    self:Show(SW_NORMAL)

    return self:Result==1

    #endif

    ~"ONLYEARLY-"

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1