• Hi Julian,

    I am having real problems with this method. I am trying to set the borderwidths of the borders of table cells. Sometimes I can get it to do it and other times not. I have analysed the code for the method and I think there are potentially some bugs with it.

    As an example I was setting the borderwidth to 3 points. At first, the ASet procedure was reporting that the FParAttrVal array included the wpat_code and matched the value, even though the borderwidth had not previously been set.

    I then tried ADel to delete the borderwidth value before setting it. This got me past the initial problem and into the else statement following if i>=0. I checked that the value of "card" was as desired (ie 60 twips) which it was and so this should have added the appropriate code and value to the array and triggered an update. However, it didn't and when it came to calling the wpDrawBorder procedure in WPRTEDefs the value had been reset to the default value of 10 twips. I have tried but found it difficult to follow what happens between ASet and wpDrawBorder.

    Can you please let me know if this is a bug or if it would appear that I am doing something wrong.

    Regards

    Mark

    • Offizieller Beitrag

    Hi,

    If you have doubts about the code of ASet() please send me an e-mail about it. Unless the code does triggers an compiler problem I don't know about I believe the code is correct.

    I think your code is not working because the WPAT_BorderWidth is overridden by WPAT_BorderWidthL..WPAT_BorderWidthDiaTRBL (which you can clear with ADelFromTo).

    Note: WPAT_BorderWidth is the default border width, each of the lines can use its own width. (DiaTLBR and DiaTRBL are reserved).

    Julian

  • Hi Julian,

    What I am actually doing is seeting the borders one by one. I cannot delete all the border properties only the one that I am currently dealing with.

    There are no compiler errors it just seems that the request to update the properties from ASet is either not happening (even though my tests confirm the function is being called) or it is somehow losing the new value between ASet and wpDrawBorder and I cannot work out which it is.

    Any suggestions as to how I can get this working on a border by border basis?

    Thanks.

    • Offizieller Beitrag

    Hi,

    >> Any suggestions as to how I can get this working on a border by border basis?

    Sorry, I cannot follow. If you want to set individual borders you need to modify WPAT_BorderWidthL (L for left, and also R, T, B)

    To check if the attribute is there after you set it you can simply read the current paragraph attribute as WPCSS string.

    Maybe the confusion is that the border attributes are not used by DrawBorder. It skiups borders it detects to be duplicated at one position (left and right borders of adjacent cells)

    Julian

  • Hi Julian,

    Perhaps it is better if I explain what I am doing. I am trying, as far as possible, to replicate Word's table handling. I have created a table properties dialog which is similar to Word's and which works well, even setting the border widths. This is because I deal with all the borderwisdths (and other properties) in one function. I delete all border and other relevant properties before I reset them again and then I reset them one by one, dealing with left then right etc. This works fine using ASet.

    In addition to this I am replicating the way Word's Tables and Border toolbar deals with setting table properties. As you will of course realise, you can choose to deal with any of the borders in isolation from the rest. So if the user chooses to deal with the left border in isolation, I need to set only the left border. At first, I was not deleting any properties and trying to set, for example, the left border, the ASet function was finding the code and value required in the array ie it was reporting that i>=0 and that FParAttrVal[i] and $FF000000) = c which was wrong. I then tried deleting the wpat_BorderwithL value to clear it form the array before trying to set it again. When I did this, ASet was reporting that i<0 and also I checked that "Card" was the correct value in twips. It also then proceeded to the ANeedUpdateProps function, but did not change the border width from 10 to the required 60. I analysed the value being received by wpDrawBorder and instead of registering 60 twips it had somehow been demoted to 10 twips during the intervening process.

    I hope this is clearer.

    Regards

    Mark

    • Offizieller Beitrag

    Hi,

    I am working on new dialogs as well and I am open for suggestions. But when I read your post I think there is a problem with overriding properties which should not be set. A dialogl should always only modify the values the user explicitely set, except that you ally something like a style. But here WPTools has some methods based on the WPCSS strings would could be useful.

    The problem with the border is caused because of the adjacent cells. It is a bit hard to have drawn through lines in a table and also around cells without some logic which skips double lines.

    Julian

  • Following a previous suggestion, I have overriden your logic that determines whether it needs to add left or bottom cells depending on whether the adjacent right or top border is set. I found this to be very problematic for example when different styles are set for the left border and its adjacent right border or if you have a double line border set. Accrodingly all the borders are set for every cell. I have then added some code to your various units which works out whether the right or top borders are set on adjacent cells and if they are it works out whether to draw one or other of the lines (it will ignore one of them if the sytles and thickness are the same) if not it tries to work out how to draw the adjacent borders. Have not got it quite right yet, but will continue working on it. More than happy to give it to you when finished so you can improve on it if you wish. Would much prefer to see this sort of thing in wpTools as standard. You're also more than welcome to my dialogs.

    However, the issue of adjacent cells is not one that is affecting whether to draw the width of the border. Setting the border width is not just a problem for the left border it is a problem for all borders, I just chose left as an example.

    Any ideas?

    Thanks

    • Offizieller Beitrag

    Hi,

    >> More than happy to give it to you when finished so you can improve on it if you wish. Would much prefer to see this sort of thing in wpTools as standard. You're also more than welcome to my dialogs. <<Yes>>However, the issue of adjacent cells is not one that is affecting whether to draw the width of the border. Setting the border width is not just a problem for the left border it is a problem for all borders, I just chose left as an example. <<

    But I am really not sure. The ASet procedure seems to be ok. If you save the file in WPT format you will see the properties in readable form. So you can check what props are there and if they are what you expected.

    Julian